cuda docker image

 The docker environment will inevitably be used in work or development. As a worker in deep learning, cuda is inevitable. It is really hard to build by yourself, see the recommended method on tf's official website.

Fortunately, Nvidia officially made a lot of mirrors- nvidia/cuda.

He also improved many historical versions - here .

Remember, you must choose the version in the mirror based on the local cuda and cudnn versions. If it does not match, it will not be recognized.

The following is their github library , related to the content of ubuntu+cuda. Very basic. Cannot be used directly.

ARG BASEIMAGE
FROM ${BASEIMAGE}

# packaging dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
        dh-make \
        fakeroot \
        build-essential \
        devscripts \
        lsb-release && \
    rm -rf /var/lib/apt/lists/*

# packaging
ARG PKG_VERS
ARG PKG_REV
ARG RUNTIME_VERSION
ARG DOCKER_VERSION

ENV DEBFULLNAME "NVIDIA CORPORATION"
ENV DEBEMAIL "[email protected]"
ENV REVISION "$PKG_VERS-$PKG_REV"
ENV DOCKER_VERSION $DOCKER_VERSION
ENV RUNTIME_VERSION $RUNTIME_VERSION
ENV SECTION ""

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS
RUN mkdir -p $DIST_DIR /dist

# nvidia-docker 2.0
COPY nvidia-docker $DIST_DIR/nvidia-docker
COPY daemon.json $DIST_DIR/daemon.json

WORKDIR $DIST_DIR
COPY debian ./debian

RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \
    sed -i "s;@VERSION@;${PKG_VERS};" $DIST_DIR/nvidia-docker && \
    if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then echo "$(dpkg-parsechangelog --show-field=Version)" && exit 1; fi

CMD export DISTRIB="$(lsb_release -cs)" && \
    debuild --preserve-env --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
    mv /tmp/*.deb /dist

 

Guess you like

Origin blog.csdn.net/weixin_39875161/article/details/115359520