- Image : Template for environment (OS, Software, Applications)
- Container : Running instance of an image
- Dockerfile : Text document that contains all the commands to assemble an image.
- Volumes : Preferred mechanism for persisting data generated by and used by Docker containers
- Kubernetes: Container-orchestration system for automating application deployment, scaling, and management.
- docker run image
- docker start container
- docker stop container
- docker ps
- docker ps -a (for stopped containers)
- docker rm $(docker ps -a -q) (remove all stopped containers)
- docker rm container
- Docker in 12minutes
- What is a container
- Get started
- Containers, Docker ands Kubernetes
- Connecting containers
- Docker Compose for multiple containers.
Running a Jupyter Tensorflow Notebook Server:
docker run --rm -p 8888:8888 -v "$PWD":/home/jovyan/work jupyter/tensorflow-notebook:latest
Here, ' -p 888:8888 ' maps the machines 8888 port to containers 8888 port. Also, ' -v <machine_path>:<container_path> ' maps the machines working directory to container's path (usually predefined). Here we map ' $PWD ' i.e current directory's path with container's predefined path '/home/jovyan/work'. For more info lookup: jupyter-notebook stacks
Building images [WIP]
Create a dockerfile with image config:
$ docker build -t imagename .
Building an image could be hectic if the commands are not ordered properly. Here are some tips:
- 1. Avoid using '&&' between all RUN commands as this disables checkpointing (using cache).
- 2. Use COPY commands after RUN commands. This enables checkpointing(using cache) after every RUN.
Running as a daemon and accessing container shell
$ docker run -it -d --name container_name image_name /sbin/init
$ docker exec -it container_name sh
Creating a network
$ docker network create network_name
$ docker run --network network_name --name container_name image_name
Last updated 28 March 2020