본문 바로가기

IT/Docker

[Docker] nvidia-docker의 Dockerfile

 

[Docker] Dockerfile 개념 및 작성법

Dockerfile Dockerfile은 DockerImage를 생성하기 위한 스크립트(설정파일)이다. 여러가지 명령어를 토대로 Dockerfile을 작성한 후 빌드하면 Docker는 Dockerfile에 나열된 명령문을 차례대로 수행하며 DockerImage

wooono.tistory.com

Dockerfile

  • Dockerfile은 DockerImage를 생성하기 위한 스크립트(설정파일)이다.
  • 여러가지 명령어를 토대로 Dockerfile을 작성한 후 빌드하면
  • Docker는 Dockerfile에 나열된 명령문을 차례대로 수행하며 DockerImage를 생성해준다.
  • Dockerfile을 읽을 줄 안다는 것은 해당 이미지가 어떻게 구성되어 있는지 알 수 있다는 의미이다.
FROM nvidia/cuda:10.2-cudnn7-devel

RUN echo 'export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}' >> ~/.bashrc
RUN echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
RUN echo 'export PATH=/usr/local/cuda/bin:/$PATH' >> ~/.bashrc
RUN echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-get update
RUN apt-get install -y vim
RUN apt-get install -y git
RUN apt-get install -y build-essential unzip pkg-config libssl-dev
RUN apt-get install -y libjpeg-dev libpng-dev libtiff-dev
#RUN apt-get install -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev v4l-utils libxvidcore-dev libx264-dev libxine2-dev
RUN apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
RUN apt-get install -y libgtk-3-dev
RUN apt-get install -y mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev
RUN apt-get install -y libatlas-base-dev gfortran libeigen3-dev
RUN apt-get install -y python2.7-dev python3-dev python-numpy python3-numpy

EXPOSE 80
EXPOSE 443

 

  • Error NO_PUBKEY A4B469963BF863CC when run Dockerfile
    • apt-get update가 안됨, 위와 같은 오류 발생
    • key값이 없기때문
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
 

Error NO_PUBKEY A4B469963BF863CC when run Dockerfile · Issue #955 · open-mmlab/OpenPCDet

I fixed it with additional key as below ( before # Install basics ): RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/3bf863cc.pub With $distro/$a...

github.com

 

  • 생성한 Dockerfile을 Image로 빌드
docker build -t apache-image .

docker build -t [이미지 이름:이미지 버전] [Dockerfile의 경로]

 

'IT > Docker' 카테고리의 다른 글

[Docker] failed to Lchown  (0) 2023.06.07
[Docker] nvidia-docker 설치 및 실행  (0) 2023.04.06
[Docker] Docker run 옵션 추가하기  (0) 2021.12.03
[Docker] link 후 jupyter notebook, -p(port) 옵션  (0) 2021.11.29
[Docker] nvidia-docker  (0) 2021.11.29