Lecture 03 – DOCKER ENGINE INSTALLATION
DOCKER ENGINE INSTALLATION
Pre-Requisites:
Launch Ubuntu instance t2.small.
Create an account Docker hub repository for storing docker images in public Docker Registry
Steps To install Docker Engine on Ubuntu server.
Step 01: To update system packages, Install necessary packages to allow apt to use a repository over HTTPS and add the official Docker GPG key.
COPY & RUN –>$ the below commands
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 02: To add the Docker repository for x86_64/AMD64 architecture:
COPY & RUN –>$ the below command
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
OPTIONAL: For ARM64 architecture:
COPY & RUN –>$ the below command
echo "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Please note that the above commands assume you’re using the stable version of Docker. If you prefer to use a different release channel (e.g., edge or test), you can modify the URL accordingly.
Step 03: To update the package database with the Docker packages from the newly added repository and install Docker engine:
COPY & RUN –>$ the below commands
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
Step 04: To add your user to the ‘docker’ group to run Docker commands without sudo and to adjust permissions on the Docker socket file.
COPY & RUN –>$ the below commands
sudo usermod -aG docker $USER
sudo chmod 666 /var/run/docker.sock
To verify the Docker installation and to test run Docker container.
COPY & RUN –>$ the below commands
docker --version
docker run hello-world
It should display the above message on your terminal.
