In this post, we will try to install Docker on Ubuntu 22.x Docker is a containerization platform
and Ubuntu is a Linux-based operating system.
Update the system
sudo apt updateIt’s important to get the new updates on your operating system such that nothing breaks when we install software on the operating system.
Install the dependencies in Ubuntu
sudo apt install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -yYou need to have the dependencies installed before installing the Docker.
In -y option in the apt install command will install the dependencies automatically without asking for Yes or No in the prompt
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"You need to add the above repository because docker binaries will be installed from here.
Install Docker in Ubuntu
sudo apt install docker-ce docker-ce-cli containerd.io -yYou will be installing the community edition of docker so we are using docker-ce and docker-ce-cli
sudo usermod -aG docker $USERsudo chmod 666 /var/run/docker.sockdocker versionThis will output the version of Docker.
Manage docker service
sudo systemctl status dockerYou can check the status of the Docker daemon. This will help you to know that docker is running or not.
sudo systemctl start dockerYou can start docker using the above command
sudo systemctl enable dockerWhen your operating system restarts/starts then Docker will automatically start if you enable it using the systemctl command
sudo systemctl restart dockerYou can restart the docker daemon using the above command
References
Next Read: Ten Important Commands in Docker
