Set up Docker CE For Ubuntu 24.04 – Easy and Full Setup
This guide aims to demonstrate how to set up Docker CE For Ubuntu 24.04. As you likely know, Docker is a powerful open-source tool that enables you to create, deploy, and run applications in containers. Docker CE (Community Edition) is a free package provided by Docker, available through a third-party package repository for most Linux distributions.
The Docker CE For Ubuntu 24.04 setup is quite straightforward. You can now follow the steps provided by the Orcacore team and initiate your Docker CE installation on Ubuntu 24.04. This comprehensive guide ensures a smooth Docker CE For Ubuntu 24.04 installation process.
Step-by-Step Set up Docker CE For Ubuntu 24.04
To begin the installation of Docker CE for Ubuntu 24.04, you’ll need to access your Ubuntu system as a non-root user with sudo privileges. If you’re unsure how to create a sudo user, refer to this guide on Create a New Sudo User on Ubuntu 24.04.
Also, check out the video tutorial for setting up Docker:
Step 1 – Install Required Packages For Docker Setup on Ubuntu 24.04
To set up Docker CE for Ubuntu 24.04, it’s essential to prepare your system beforehand. Start by running a system update and upgrade using the following command:
sudo apt update && sudo apt upgrade -y
Next, you’ll need to install some required packages and dependencies. Execute the following command to install them:
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
Now, proceed to the next step to install Docker CE on Ubuntu 24.04. In this guide, we’ll utilize the official Docker APT repository to set up Docker CE for Ubuntu 24.04.
Step 2 – Add Docker’s official GPG key on Ubuntu 24.04
At this point, you need to add the official GPG key of the Docker APT repository to your Ubuntu 24.04 system. To accomplish this, execute the following commands:
# sudo install -m 0755 -d /etc/apt/keyrings
# sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
# sudo chmod a+r /etc/apt/keyrings/docker.asc
Step 3 – Add Docker repository to the APT sources on Ubuntu 24.04
Now, you must add the Docker repository to your APT sources. You can easily do this by running the following command:
echo
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Once you’re done, run the system update to apply the changes:
sudo apt update
Step 4 – Install Docker on Ubuntu 24.04
After adding the repository, you can install and set up Docker CE For Ubuntu 24.04 using the following command:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y
Check Docker Status
The Docker CE service should be enabled and activated during the installation of Docker CE For Ubuntu 24.04. To verify this, run the command below:
sudo systemctl status docker
In your output, you should see:

Step 5 – Execute Docker Commands Without Using Sudo
At this point, you’ve successfully set up Docker CE for Ubuntu 24.04. By default, the docker command can only be run by the root user or a user in the docker group. The docker group is created during the installation process.
If you want to execute docker commands without using sudo, you need to add your user to the docker group with the following command:
sudo usermod -aG docker ${USER}
To apply this change, run the following command:
su - ${USER}
You may be prompted to enter your username’s password to continue.
You can verify that your user has been added to the docker group with the following command:
id -nG
In the rest of this article on Docker CE For Ubuntu 24.04, we’ll run the docker commands as a user in the docker group. If you prefer not to do this, remember to run the commands with a user with sudo privileges.
Now, let’s explore how the docker command works.
Step 6 – How To Use Docker on Ubuntu 24.04?
First, let’s start with the general syntax of the Docker command:
docker [<mark>option</mark>] [<mark>command</mark>] [<mark>arguments</mark>]
You can list all available subcommands for Docker with the following command:
docker
In your output, you should see:

Now, proceed to the following steps to learn how to work with Docker commands, such as pulling images, creating containers, and more.
Work with Docker Images on Ubuntu 24.04
A Docker Image is a portable file that contains a set of instructions specifying which software components the Container should run and how to run them. By default, Docker pulls these images from Docker Hub.
First, you can verify that you have access to download images from Docker Hub with the following command:
docker run hello-world
In your output, you should see:

Then, you can start searching for and downloading Docker images on Ubuntu 24.04. For example, we’ll search for an Ubuntu image using the command below:
docker search ubuntu
In your output, you will see something similar to this:

After searching, we’ll download the official Ubuntu image using the command below:
docker pull ubuntu
Once the download is complete, you should see:

You can also list your downloaded images using the following Docker command:
docker images
**<mark>Exmaple Output
</mark>**REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest edbfe74c41f8 6 weeks ago 78.1MB
hello-world latest d2c94e258dcb 16 months ago 13.3kB
At this step of setting up Docker CE for Ubuntu 24.04, you’ve learned how to work with Docker images. Now, let’s see how you can run Docker containers and work with them.
Work with Docker Containers on Ubuntu 24.04
Containers are a great alternative to virtual machines. They isolate execution environments while sharing the operating system’s core.
For example, let’s run a container using the latest image of Ubuntu that we downloaded. To do this, run the following command:
docker run -it ubuntu
Note: The -it
switches provide interactive shell access to the container.
You should see the following in your output:
orca@**<mark>983f76ee9ca6</mark>**:/#
Important note: Remember the container ID. In this case, the container ID is 983f76ee9ca6.
Now, you can run any command within your container without using sudo because you’re executing commands as the root user inside the container. For example, let’s run apt update
and install the Nginx web server in our Ubuntu container:
orca@**<mark>983f76ee9ca6</mark>**:/# apt update
orca@**<mark>983f76ee9ca6</mark>**:/# apt install nginx -y
You can verify your installation by checking its version from within the container:
orca@**<mark>983f76ee9ca6</mark>**:/# nginx -v
nginx version: nginx/1.24.0 (Ubuntu)
Note: Any changes you make inside the container only apply to that specific container.
To exit the container, type exit
:
orca@**<mark>983f76ee9ca6</mark>**:/# exit
List Available Containers
You can view active containers by running the following command:
docker ps
**<mark>Example Output
</mark>**CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Note: We started two containers in this article, but they aren’t currently active. Therefore, they aren’t displayed in the list of active containers.
To see all containers, both active and inactive, run the following command:
docker ps -a
**<mark>Example Output
</mark>**CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
983f76ee9ca6 **ubuntu** "/bin/bash" 9 minutes ago Exited (130) 4 minutes ago brave_taussig
957b983291e2 **hello-world** "/hello" 20 minutes ago Exited (0) 20 minutes ago nervous_maxwell
You can also see the latest container that you created with the following command:
docker ps -l
**<mark>Example Output
</mark>**CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
983f76ee9ca6 **ubuntu** "/bin/bash" 10 minutes ago Exited (130) 5 minutes ago brave_tausig
Manage Docker Containers
You can start and stop a container using its container ID or container name. Here, we’ll start the Ubuntu container using its ID:
docker start **<mark>983f76ee9ca6</mark>**
Now, you can check the status to see if your container is active:
docker ps
Here, you can stop the container. This time, we’ll use the container’s name to stop it. The container name is displayed when you list the containers.
docker stop <mark>brave_tausig</mark>
You can also remove a container using its container ID or container name. For example, let’s remove the hello-world container using its name with the following command:
docker rm <mark>nervous_maxwell</mark>
That’s it! You’ve completed setting up Docker CE for Ubuntu 24.04. For more information, you can visit the official Docker Documentation page.
Conclusion
As you’ve seen from the guide steps, installing Docker on Ubuntu is a straightforward process. You can easily add the official Docker repository to APT sources and install Docker CE. Working with Docker commands is also simple. You can easily search for and download Docker images, as well as run and manage Docker containers. We hope you found this guide on setting up Docker CE for Ubuntu 24.04 helpful.
You may also like to read the following articles:
Run Docker Containers with Portainer
Start a Docker Container with Exited Status
Run a Python Script in a Linux Docker Container
Heimdall Application Dashboard on Linux with Docker
Install Docker CE on Debian 12 Bookworm
FAQs
Can Docker CE Run on Other Versions of Ubuntu?
Yes, Docker CE can run on Ubuntu 18.04, 20.04, and Ubuntu 22.04. Each version might have slight differences in installation procedures or dependencies.
How Do I Update Docker CE on Ubuntu 24.04?
To update Docker CE, use the following command:sudo apt update && sudo apt upgrade
Can I Use Docker Without Sudo?
Yes, you can configure Docker to run without sudo. Add your user to the Docker group as we explained in the guide steps.
Is Docker CE Free to Use?
Yes, Docker CE is open-source and free to use. However, Docker offers a paid version called Docker Enterprise for additional features and support.
Alternative Solutions for Installing Docker on Ubuntu 24.04
While the above method using the official Docker repository is the recommended and most common approach, alternative methods exist, albeit less frequently used. Here are two alternative approaches:
1. Using Docker’s Convenience Script:
Docker provides a convenience script for installing Docker CE on Linux. This method is simpler but less customizable and might not be suitable for production environments where fine-grained control is needed.
-
Explanation: The script automates the process of adding the Docker repository, installing the necessary packages, and starting the Docker service. It’s a quick way to get Docker up and running, especially for testing or development purposes. However, it bypasses some of the manual configuration steps, which could be limiting in certain scenarios.
-
Code Example:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER newgrp docker docker run hello-world
curl -fsSL https://get.docker.com -o get-docker.sh
: Downloads the Docker installation script.sudo sh get-docker.sh
: Executes the downloaded script to install Docker.sudo usermod -aG docker $USER
: Adds the current user to thedocker
group.newgrp docker
: applies the group membership change to the current session.docker run hello-world
: Verifies the installation.
2. Installing from Snap Store:
Another method is to install Docker CE via the Snap Store, which is available by default on Ubuntu. This approach offers a simplified installation process and automatic updates.
-
Explanation: Snaps are containerized software packages that are easy to install and update. Installing Docker via Snap simplifies the dependency management and update process. However, Snap packages are generally larger in size compared to APT packages, and some users might prefer the control offered by APT.
-
Code Example:
sudo snap install docker sudo usermod -aG docker $USER newgrp docker docker run hello-world
sudo snap install docker
: Installs Docker from the Snap Store.sudo usermod -aG docker $USER
: Adds the current user to thedocker
group.newgrp docker
: applies the group membership change to the current session.docker run hello-world
: Verifies the installation.
These alternative methods provide flexibility in how you install Docker CE on Ubuntu 24.04. Choose the method that best suits your needs and experience level. However, using the official Docker repository is generally recommended for production environments due to its stability and control.