Install Docker on Ubuntu
Quick guide to install Docker on Ubuntu. Follow these simple steps to get Docker up and running on your system.
Published Aug 18, 2024
To install Docker Desktop successfully, your Linux host must meet the following general requirements:
- 64-bit kernel and CPU support for virtualization.
- KVM virtualization support.
- At least 4 GB of RAM.
- Have a 64-bit version of either the latest LTS version (Ubuntu Jammy Jellyfish 22.04) or the current non-LTS version (Ubuntu Mantic Minotaur 23.10). Docker Desktop is supported on
x86_64
(oramd64
) architecture. - For non-Gnome Desktop environments,
gnome-terminal
must be installed:
Recommended approach to install Docker Desktop on Ubuntu:
- Set up Docker's
apt
repository.
- Install the Docker packages.
Latest:
Specific version:
To install a specific version of Docker Engine, start by listing the available versions in the repository:
Select the desired version and install:
- Verify that the Docker Engine installation is successful by running the
hello-world
image.
This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
- Download latest DEB package.
- To start Docker Desktop for Linux, search Docker Desktop on the Applications menu and open it. This launches the Docker menu icon and opens the Docker Dashboard, reporting the status of Docker Desktop.
Alternatively, open a terminal and run:
After you’ve successfully installed Docker Desktop, you can check the versions of these binaries by running the following commands:
To enable Docker Desktop to start on sign in, from the Docker menu, select Settings > General > Start Docker Desktop when you sign in to your computer.
Alternatively, open a terminal and run:
To stop Docker Desktop, select the Docker menu icon to open the Docker menu and select Quit Docker Desktop.
Alternatively, open a terminal and run:
Docker Desktop for Linux provides a user-friendly graphical interface that simplifies the management of containers and services. It includes Docker Engine as this is the core technology that powers Docker containers. Docker Desktop for Linux also comes with additional features like Docker Scout and Docker Extensions.
The Docker CLI can be used to interact with multiple Docker Engines. For example, you can use the same Docker CLI to control a local Docker Engine and to control a remote Docker Engine instance running in the cloud. Docker Contexts allow you to switch between Docker Engines instances.
While it’s possible to run both Docker Desktop and Docker Engine simultaneously, there may be situations where running both at the same time can cause issues. For example, when mapping network ports (
-p
/ --publish
) for containers, both Docker Desktop and Docker Engine may attempt to reserve the same port on your machine, which can lead to conflicts ("port already in use").When installing Docker Desktop, a dedicated “desktop-linux” context is created to interact with Docker Desktop. Docker Desktop automatically sets its own context (
desktop-linux
) as the current context. This means that subsequent Docker CLI commands target Docker Desktop. On shutdown, Docker Desktop resets the current context to the default
context.Use the
docker context ls
command to view what contexts are available on your machine.If you have both Docker Desktop and Docker Engine installed on the same machine, you can run the
docker context use
command to switch between the Docker Desktop and Docker Engine contexts. For example, use the "default" context to interact with the Docker Engine:And use the
desktop-linux
context to interact with Docker Desktop: