Docker Terminology

  • Image: Is a blueprint for what you want to build. Ex: Ubuntu + TensorFlow with Nvidia Drivers and a running Jupyter Server.
  • Container: Is an instantiation of an image that you have brought to life. You can have multiple copies of the same image running. It is really important to grasp the difference between an image and a container as this is a common source of confusion for new comers.
  • Dockerfile: Recipe for creating an Image. Dockerfiles contain special Docker syntax. From the official documentation: A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
  • Commit: Like git, Docker containers offer version control. You can save the state of your docker container at anytime as a new image by committing the changes.
  • DockerHub / Image Registry: Place where people can post public (or private) docker images to facilitate collaboration and sharing.
  • Layer: modification to an existing image, represented by an instruction in the Dockerfile. Layers are applied in sequence to the base image to create the final image.

Reference

How Docker Can Help You Become A More Effective Data Scientist (Hamel Husain , 2017) [Link]

Docker Documentation for MAC [link]

Container

Check container statement

docker container ls -a

or

docker ps

Romove a container

docker rm /<container_name>

Exploring

This command should let you explore a running docker container:

docker exec -it name-of-container bash

This command should let you explore a docker image:

docker run --rm -it --entrypoint=/bin/bash name-of-image

This command should let you inspect a running docker container or image:

docker inspect name-of-container-or-image

copy directly from the container as it was any other part of your filesystem. For example, recovering all files inside a container:

mkdir /tmp/container_temp
docker cp example_container:/ /tmp/container_temp/