How to use docker

Jimmy (xiaoke) Shen
1 min readSep 23, 2020

--

Get started by running a TensorFlow image

See HERE

Docker cheat sheet

Customize docker image

By following the instruction from HERE

Dockerfile

# getting tensorflow base image
FROM tensorflow/tensorflow
RUN apt-get update && \
apt-get install git -y && \
apt-get install wget -y && \
apt-get install vim -y && \
apt-get install graphviz -y
COPY requirements.txt /tmp
WORKDIR /tmp
RUN pip install -r requirements.txt

requirement.txt file

matplotlib==3.3.2
keras==2.4.3
tabulate
pydot

Build the Dockerfile

docker build -t tf:2.3 .

Check images

jimmy@jimmys-MacBook-Pro experimental % docker imagesREPOSITORY               TAG                 IMAGE ID            CREATED             SIZEtf                       2.3                 6e19d2bbaa54        44 seconds ago      1.68GBmyimage1                 1.0                 36736a968941        12 hours ago        95.8MBubuntu                   latest              bb0eaf4eee00        6 days ago          72.9MBtensorflow/tensorflow    latest              539d0e818045        8 weeks ago         1.54GB

Run docker images

docker run -it --rm -v $PWD:/tmp -w /tmp tf:2.3 bash

Run the above command, you will see

Reference

[1]https://towardsdatascience.com/build-a-docker-container-with-your-machine-learning-model-3cf906f5e07e

--

--

Responses (1)