Docker on Ubuntu: Complete Installation Guide

To install and use Docker containers on Ubuntu, you can follow these steps:

  1. Update Ubuntu package index.
sudo apt update
  1. Install the necessary software packages to enable Ubuntu to use HTTPS.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
  1. Add the official GPG key for Docker.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Add the stable version of Docker software package repository.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Update the package index.
sudo apt update
  1. Install the Docker engine.
sudo apt install docker-ce
  1. Start the Docker service and set it to launch automatically at startup.
sudo systemctl start docker
sudo systemctl enable docker
  1. Check if Docker has been successfully installed.
docker --version

You can now manage containers using Docker commands. For example, you can pull an Ubuntu image and run a container with the following command:

docker pull ubuntu
docker run -it ubuntu

This will open an interactive session within the Ubuntu container where you can execute commands. To exit the container, you can use Ctrl + D or input the exit command.

I hope this guide can assist you in installing and using Docker containers on Ubuntu.

bannerAds