Summarized Demystifying Docker for Data Scientists – A Docker Tutorial for Your Deep Learning Projects
You could learn
- how to make container from image
- how to make image from container
- how to use dockerfile to build image
docker run -it --name mycntkdemo microsoft/cntk:2.2-cpu-python3.5 /bin/bash
pip install lightgbm
: install python lightgbm package in docker.exit
: exit from the container.docker start -ia mycntkdemo
: start mycntkdemo named container.Ctrl-p + Ctrl-q
: move container to the background.docker attach mycntkdemo
: move container from background to foreground.docker run -it --name mycntkdemo -v /home/test:/root/test
: map local dir(/home/test
) to docker dir(/root/test
)docker run -it --name mycntkdemo -v /home/test:/root/test microsoft/cntk:2.2-cpu-python3.5 /bin/bash
: map local dir to docker dir when initialize a container.docker commit mycntkdemo mycntkwlgbm:version1
: tag container and save as new image.
- Dockerfile.
cat Dockerfile
FROM microsoft/cntk:2.2-cpu-python3.5
RUN apt-get update \
&& apt-get install -y git
COPY . /root/mylightgbmex
RUN /root/anaconda3/envs/cntk-py35/bin/pip install -r /root/mylightgbmex/requirements.txt
CMD ["echo 'hello'"]
- Requirements for package installation.
cat requirements.txt
wheel
lightgbm
docker build -t mycntkwlgbmimage
: creates an image named mycntkwlgbmimage by reading Dockerfile.