Docker helps developers build, share, run, and verify applications anywhere with containers. More info on containers here.

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

This can be used on other operating systems and services such as Ubuntu, NGINX, mysql, and so many more here on Docker Hub.

Docker Overview

You can find Docker images here on their Hub that you can pull and use.

Differences between Docker and a VM

The main difference between Docker and VMs is their architecture.

VMs have the host OS and guest OS inside each VM. A guest OS can be any OS, like Linux or Windows. They are stand-alone with their kernel and security features. Therefore, applications needing more privileges and security run on virtual machines. They are more resource-intensive than Docker containers as the virtual machines need to load the entire OS to start.

Docker containers host on a single physical computer with a host OS, which shares among them. Sharing the host OS between containers makes them light and increases the boot time. Docker containers typically are run with root(admin) privileges. The container technology has access to the kernel subsystems; as a result, a single infected application is capable of hacking the entire host system. The lightweight architecture of Docker containers is less resource-intensive than virtual machines.


Debian based Linux

sudo apt install docker-compose

More info for linux installation can be found here on their docs.


Download docker for Windows here and run the installer. When prompted, ensure the Use WSL 2 instead of Hyper-V option on the Configuration page is selected or not depending on your choice of backend.

If your system only supports one of the two options, you will not be able to select which backend to use.

More info for Windows installation can be found here on their docs.


Download the appropriate the .dmg for the M1 Chip or Intel Chip.

Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder.

Double-click in the Applications folder to start Docker.

More info for MacOS installation can be found here on their docs.


Docker commands can be found here.

Common Commands

  • Pull an image or a repository from a registry

sudo docker pull (image)
  • List pulled images

sudo docker images
  • Run a docker image with the given name (--name) from the chosen image

sudo docker run --it --name (name the container) (image_name)
  • Start a container to have it run in the background

sudo docker start (container_id)
  • Stop a running container

sudo docker stop (container_id)
  • Show running containers

sudo docker ps
  • Shows what containers are taking up what resources

sudo docker stats
  • Share your images to the Docker Hub registry or to a self-hosted one.

sudo docker push (image:tag)
  • Shows all docker images

sudo docker images
  • Removes a container

sudo docker rm [container_id]
  • Removes an Image

sudo docker image rm [image_name]

Image versions

Some images may have various versions, we can select which version we want to pull and load. Eg. Ubuntu versions can be found here on the Docker hub and we can pull a specified Ubuntu image version with

sudo docker pull ubuntu:22.04

and run it with

sudo docker run --it --name ubuntu ubuntu:20.04

Verify it's running with

sudo docker ps

We can now interact with it by running

sudo docker exec -it buntu

Last updated