Install docker
Lab setup on AWS
- Create a ubuntu server in AWS (t3.micro)
- Ensure ssh keys are setup
- Create a security group in AWS with all ports opened.
- Note: Watch classroom recording for creating server
Docker installation on Linux
- we have two ways of installing docker
- a script
- commands
Command based installation
- Refer Here for official installation docs
- Run the following commands
# Add Docker's official GPG key:
sudo apt update
sudo apt install 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
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
- docker installation will create a group called as docker. All the users who are part of this group can communicate with docker daemon.
- Lets add a current user (ubuntu) to the docker group
sudo usermod -aG docker ubuntu
Script based installation
- This works on all popular distributions
curl -fsSL https://get.docker.com -o /tmp/install-docker.sh
sh /tmp/install-docker.sh
- Add the user to the docker group, logout and login
What is happening inside container
Examine Linux Host
-
Command:
docker run -d --name inspect1 alpine sleep 1d -
Processes
- Disks

- CPU, memory and running processes

- Network

Examine inside a container
- Let me run a alpine image
docker run -d --name inspect1 alpine sleep 1d
- Let me execute interactive commands inside container
docker exec -it inspect1 /bin/sh
- Disks

- process

- network

-
cpu, memory
-
Conclude: Each container gets
- its own disk contents (from image)
- its own network and network interface
- its own cpu and ram
- its own process tree
-
Exercise:
- Install docker on ubuntu in AWS
- try the same experiment with
- ubuntu:24.04 image
- fedora:42 image
