How to Install and Setup Docker on Ubuntu

Updated at

Docker is a popular containerization platform that allows you to build, deploy, and run applications in containers. Here are the steps to install and set up Docker on Ubuntu:

1. Update the package index and install the necessary packages:

sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release

2. Add the Docker GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3. Add the Docker repository to your system:

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

4. Update the package index again and install Docker:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

5. Verify that Docker is installed and running:

sudo systemctl status docker

You should see output indicating that Docker is active and running.

6. Add your user to the Docker group:

sudo usermod -aG docker your-user

Replace "your-user" with your username. This allows you to run Docker commands without using "sudo".

7. Test Docker by running the "hello-world" container:

docker run hello-world

Docker will download the "hello-world" container image and run it. You should see output indicating that Docker is working correctly.

That's it! You have successfully installed and set up Docker on Ubuntu.

YottaSrc footer

why choose us?

Better Pricing, Fast SSD Storage and Real 24/7
Technical Support.

control panel icon

Managing Your Site Through CPanel With The Latest Version

security icon

99.8% Uptime Guarantee.
So Focus On Your Work!

support icon
24/7/365 Support

Day or night, rain or shine,
our team is here for you!

cloud backup icon
Daily Backup

Daily & Weekly Backup.
Your Files Are Safe!