Docker |
rans>Skip to main content



  • Docker is a platform for developers and sysadmins to develop, deploy and run applications with containers.
  • The use of Linux containers to deploy applications is called containerization.
  • An image is an executable package that includes everything needed to run an application - the code, a runtime, libraries, environment variables, and configuration files.
  • A container is simply a running instance of an image.
  • Each container runs as a simple process as seen by ps aux.
  • Portable images (which ensure your app, its dependencies and the runtime, all travel together,) are defined by something called a Dockerfile.
  • In a distributed application, different pieces of the app are called services. Services are really just containers in production. To define, run and scale services with the Docker platform, write a docker-compose.yml file.
  • A single service stack can run 5 container instances of our deployed image on one host.
  • A single container running in a service is called a task.

Docker App Hierarchy

  • Stack
  • Services
  • Container

If you build an app the Docker way, at the bottom of the hierarchy of such an app is a container. Above this level is a service, which defines how the containers behave in production. Finally, at the top level is the stack, defining the interactions of all services.


  • docker --version : see docker version.
  • docker info or docker version (without --) : see more info about your docker installation.
  • docker image ls or docker images : list all the images.
  • docker container ls : list all the running containers.
  • docker container ls --all : list all the containers, including those exited after running.
  • docker container ls -aq : list docker containers, all in quiet mode.
  • docker container COMMAND : manage containers.
  • docker ps -as : list (all) containers (with sizes).
  • sudo service docker restart : restart docker service on Linux.
  • docker run -p 4000:80 IMAGE-NAME : run docker with port remapping, 4000 is the host port, 80 is service port.
  • docker tag helloworld soham/get-started : associate a local image named helloworld with a repository named soham/helloworld on a registry. The tag is optional, but recommended for the registry to give Docker images a version.
  • docker push soham/helloworld : publish the image by uploading your tagged image to the repository. Once complete, the result of this upload are publicly available.
  • docker run -p 4000:80 soham/helloworld: pull and run the image from the remote repository. (If the image is not available locally, docker pulls it from the remote repository.)


To use TensorFlow Docker with GPU enabled in Pycharm, you need to modify docker default runtime, because it seems impossible to pass --gpus all running option when starting containers in Pycharm. First sudo apt install nvidia-container-runtime. Then modify /etc/docker/daemon.json: