Docker
Docker
for dummies
Elizaveta Kozlova
Plan
First questions I had
venv VM docker
venv VM docker
source: https://stephen-odaibo.medium.com/docker-containers-python-virtual-environments-virtual-machines-d00aa9b8475
What is it?
venv VM docker
source: https://stephen-odaibo.medium.com/docker-containers-python-virtual-environments-virtual-machines-d00aa9b8475
What is it?
venv VM docker
source: https://stephen-odaibo.medium.com/docker-containers-python-virtual-environments-virtual-machines-d00aa9b8475
What is it?
venv VM docker
isolates all
only isolates
dependencies, but
python
uses deeper parts of
host OS
creates a whole (so it must be linux)
isolated OS
What is it?
venv VM docker
isolates all
only isolates
dependencies, but
python
uses deeper parts of
host OS
creates a whole (so it must be linux)
isolated OS
container
read-write layer
image
read-only template
What is it?
Objects
container
container
version control
How to work with it?
Start
1. create a Dockerfile (in any text editor)
2. build an image
$ docker build -t image_name .
3. create a container
$ docker run -it --name=container_name
image_name
(image_name can be pulled from dockerhub;
--rm option will clean up the container when you exit)
4. do stuff as usual
5. to reconnect:
$ docker attach container_name
How to work with it?
Data
ready-to-run
$ FROM python:latest
$ RUN pip3 install jupyter
server:
$ docker run -it -p <remote port>:<container port>
--name <container name>
container:
$ jupyter notebook --ip 0.0.0.0 --port
<container port> --allow-root
How to work with it?
Jupyter
$ FROM python:latest
$ RUN pip3 install jupyter
$ CMD ["jupyter notebook", "—ip=0.0.0.0",
"--port=<container port>", «-—allow-root"]
jupyter_base:
(an image I saved on the server)
+ git