1. Introduction to Docker Desktop
Docker Desktop
Is a one-click installation application for Mac, Linux or Windows environments, allowing you to build, share, and run containerized applications and microservices.
It provides an intuitive GUI (Graphical User Interface) that allows you to manage containers, applications, and images directly from your machine. Docker Desktop can be used alone or as a supplementary tool to the CLI.
2. Introduction to Docker Engine
Docker Engine
is an open source containerization technology used to build and containerize applications. Docker engine as a client-server application:
- A server with long-running daemons.
- Specifies the API of the interface, which programs can use to communicate with and issue instructions to the Docker daemon.
- Command Line Interface (CLI) client docker.
The CLI uses the Docker API to control or interact with the Docker daemon through scripts or direct CLI commands. Many other Docker applications use the underlying API and CLI. The daemon creates and manages Docker objects such as mirrors, containers, networks, and volumes.
Docker Engine can be used on various Linux distributions, macOS, and Windows via Docker Desktop, or it can be installed as a static binary.
3. What is the difference between Docker Desktop for Linux and Docker Engine?
Docker Desktop for Linux
andDocker Engine
Can be installed side by side on the same machine. Docker Desktop for Linux stores containers and images in isolated storage locations within virtual machines and provides control to limit their resources. Using a dedicated storage location for Docker Desktop prevents it from interfering with Docker Engine installed on the same machine.
While it is possible to run Docker Desktop and Docker Engine at the same time, running both at the same time can cause problems in some cases. For example, when mapping a network port (-p /-publish) for a container, Docker Desktop and Docker Engine may try to keep the same port on your machine, which can cause a conflict ("port is already in use").
We generally recommend stopping Docker Engine when using Docker Desktop to prevent Docker Engine from consuming resources and preventing conflicts as described above.
Stop Docker Engine using the following command:
sudo systemctl stop docker containerd
If you set Docker Engine to automatically restart with the system, please use the following command:
sudo systemctl disable docker containerd
4. How to switch between Docker Desktop and Docker Engine?
The Docker CLI can be used to interact with multiple Docker Engines. For example, you can use the same Docker CLI to control local Docker Engine and Docker Engine instances running remotely in the cloud. The Docker context allows you to switch between Docker Engine instances.
When installing Docker Desktop, a dedicated one is createddesktop-linux
Context to interact with Docker Desktop. When starting Docker Desktop, its own context is automatically set as the current context. This means that subsequent Docker CLI commands will target Docker Desktop. Reset the current context to after shutdown or Docker Desktop exitdefault
Context.
usedocker context ls
Commands to view the available context on the machine. The current context is marked with an asterisk (*);
docker context ls NAME DESCRIPTION DOCKER ENDPOINT ... default * Current DOCKER_HOST based configuration unix:///var/run/ ... desktop-linux unix:///home/<user>/.docker/desktop/ ...
If you have Docker Desktop and Docker Engine installed on the same machine, you can runDocker context use
The commands switch between Docker Desktop and Docker Engine contexts.
usedefault
Context andDocker Engine
Interaction:
docker context use default default Current context is now "default"
usedesktop-linux
Context andDocker Desktop
Interaction
docker context use desktop-linux desktop-linux Current context is now "desktop-linux"
For more details about the docker context, please refer to:working-with-contexts
FAQs for Linux
This is the end of this article about a brief discussion on the difference between Docker Desktop for Linux and Docker Engine. For more related content on Docker Desktop for Linux and Docker Engine, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!