Docker
Last updated
Last updated
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.
You can find Docker images here on their Hub that you can pull and use.
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.
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 Docker.app 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.
Pull an image or a repository from a registry
List pulled images
Run a docker image with the given name (--name) from the chosen image
Start a container to have it run in the background
Stop a running container
Show running containers
Shows what containers are taking up what resources
Share your images to the Docker Hub registry or to a self-hosted one.
Shows all docker images
Removes a container
Removes an Image
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
and run it with
Verify it's running with
We can now interact with it by running