Image vs Container

  • container is a running env for image
    • it provides:
      • application image
        • postgres, redis
      • file system (virtual)
      • env configs
    • it has port to connect to the application that runs inside the container
      • for example: 5000

Basic commands

docker pull

docker pull <image>
  • it pulls an image from the registry (by default: Docker Hub)

docker images

docker images
  • returns list of downloaded/available images on your machine

docker run

docker run <image>
  • it runs/start the image in the container


  • “-d” –> runs the image in the container in detached mode (smth like as a daemon), it also returns an id of started container

docker ps

docker ps
  • returns list of all running containers
  • the list contains ids of running containers
    • these ids could be used in other commands like docker stop <id> or docker start <id>


  • “-a” –> returns list of running and stopped containers

docker stop

docker stop <container_id>
  • stops the container with id = <container_id>

docker start

docker start <container_id>
  • start the container with id = <container_id>

Subscribe to the newsletter

Get a once-per-week email with my latest content. By subscribing to this newsletter you will also be the first to receive last updates of my eBooks and courses.

0 members

Comments 💬