The following descriptions are as described by D.Merkle in "Docker: Lightweight Linux Containers for Consistent Development and Deployment". [1]
Docker is a platform for building.packaging, and runing applications in containers. Containers are lightweight isolated environments that bundle an application with all of its dependancies.
Main Terms:
Containerization - Packages code and dependencies together so the app runs consistently across any environment (dev, test, production)
Images & Containers - An image is a read-only template; a container is a running instance of that image
Docker Engine - The daemon that builds and runs containers using Linux kernel features (namespaces, cgroups) for isolation
Docker Hub - A public registry for sharing and pulling pre-built images
Lightweight vs VMs - Containers share the host OS kernel rather than running a full guest OS, making them faster and more resource-efficient than virtual machines
Dockerfile - A script of instructions to build a custom image reproducibly
Remove any possible old installations of Docker. (This is generally unecessary on a fresh install of a ubuntu but a good practice none the less.)
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
sudo apt-get remove -y $pkg
done
Setup Docker's apt repository. This ensures we are pulling the latest version of docker from docker itself instead of a third party repository.
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install Docker
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify installation
sudo docker run hello-world
Start the docker registry, since this will be a local only pipeline this will be required.
docker run -d --name registry --restart always -p 5000:5000 registry:2
(Optional) Run docker without root access
sudo usermod -aG docker $USER
newgrp docker
After this step be sure to log out and back in to have the new group go into effect.
All of these commands can be found on Docker.io.
References
[1] D. Merkel, "Docker: Lightweight Linux Containers for Consistent Development and Deployment," Linux Journal, vol. 2014, no. 239, Mar. 2014. [Online]. Available: https://dl.acm.org/doi/10.5555/2600239.2600241