How To Install and Use Docker on Ubuntu 23.10
Introduction
Docker is an application that simplifies the process of managing application processes in containers. It simplifies and standardizes application deployment, whatever the working environment. If you’re using Ubuntu 23.10 and want to install Docker, you’ve come to the right place. In this article, we’ll take you step-by-step through the installation process.
Prerequisites
To follow this tutorial, you will need the following:
Meet the system requirements.
One Ubuntu 20.04 server is set up by following the Ubuntu 23.10 initial server setup guide, including a sudo non-root user and a firewall.
Installing Docker
The Docker installation package available in the official Ubuntu repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.
First, update your existing list of packages:
#Update your existing list of package
sudo apt-get update
Install the necessary packages:
To let apt
use packages that are necessary for it to work properly. Run the following commands to install these packages:
sudo apt-get install ca-certificates curl gnupg
Add the official Docker GPG key:
This will allow your system to verify that the Docker packages you download are genuine. Here is the command to execute:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository:
Adding the Docker repository to your system will enable you to install the latest version of Docker. To do this, use the following command:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
Install Docker:
Once you’ve added the Docker repository, you can finally install Docker on your system. Simply run the following command:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Check Docker installation:
To ensure that Docker has been installed correctly, you can run the following command, which will launch a test container:
sudo systemctl status docker
Output:
If all has gone well, you should see a message indicating that your Docker installation is working correctly.
Let's do some hands on...
We will run a simple container to ensure everything is working as expected
For this head over to the Docker-hub website from where you can access the world’s largest library of container images
In the Search bar search for Whalesay, which is a demo image in Docker.
Copy the Docker Pull Command and run it in the terminal.
sudo docker pull docker/whalesay
On running this command docker will pull the image of the Whalesay application from the Docker hub. Run the following command,
sudo docker run docker/whalesay cowsay Hello-World
You’ll see a Whale saying Hello-World like this output below, indicating you're all set to go...
Subscribe to my newsletter
Read articles from Aditi Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Aditi Kumar
Aditi Kumar
I am an undergraduate Computer Science student from India. I am familiar with several Technologies like React, Node, MongoDB, SpringBoot, etc. I believe in the power of community therefore I love contributing to open source projects.