Posted in

如何检查您的 Docker 安装:Docker 桌面与 Docker 引擎_AI阅读总结 — 包阅AI

包阅导读总结

1. 关键词:Docker、Docker Desktop、Docker Engine、版本检查、容器化

2. 总结:

本文介绍了 Docker 的相关内容,包括其在软件开发中的作用、与容器化的关系,对比了 Docker Desktop 和 Docker Engine 的特点,并提供了判断正在使用 Docker Desktop 还是 Docker Engine 的多种方法。

3. 主要内容:

– Docker 成为软件开发解决方案领导者

– 提供容器化相关工具

– 发起 Open Container Initiative 和 Moby Project

– Docker Desktop 与 Docker Engine 对比

– Docker Desktop 是商业产品,包含引擎等多种组件和高级功能,跨系统有一致体验

– Docker Engine 可单独免费下载,能在支持的 Linux 上运行,无 GUI 和高级功能

– 如何判断使用的是 Docker Desktop 还是 Docker Engine

– 通过 GUI 或图标

– 检查安装位置

– 检查运行安装,使用 `docker version` 命令查看服务器版本信息

思维导图:

文章地址:https://www.docker.com/blog/blog-how-to-check-docker-version/

文章来源:docker.com

作者:Jay Schmidt

发布时间:2024/8/5 9:23

语言:英文

总字数:2319字

预计阅读时间:10分钟

评分:86分

标签:容器,Docker,Docker桌面,Docker引擎,开源


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

Docker has become a leader in providing software development solutions, offering tooling that simplifies the process of developing, testing, deploying, and running applications using containers. As such, understanding Docker’s different products, like Docker Desktop, and components, like Docker Engine, and understanding how they work together is essential for developers looking to maximize their productivity and ensure compliance with Docker’s licensing terms.

This post will clarify the distinctions and similarities between Docker Desktop and Docker Engine, and provide guidance on verifying which one you are currently using so you can make the most out of your experience.

Read on to explore how to distinguish between Docker Desktop and Docker Engine installations, identify when additional Docker tools are in use, understand Docker contexts, and review your Docker usage to ensure it complies with the Docker Licensing Agreement.

Banner docker tips

Background

The word “Docker” has become synonymous with containerization to the degree that containerizing an application is increasingly referred to as “dockerizing” an application. Although Docker didn’t create containerization, the company was the first to bring this technology to the developer community in an easily understood set of tooling and artifacts.

In 2015, Docker took the next step and created the Open Container Initiative (OCI) to define and specify how to build a container image, how to run a container image, and how to share container images. By donating the OCI to the Linux Foundation, Docker provided a level playing field for any application of container technology.

An open source effort headed up by Docker is the Moby Project. Docker created this open framework to assemble specialized container systems without reinventing the wheel. It provides a building block set of dozens of standard components and a framework for assembling them into custom platforms.

Moby comprises several components, including a container engine, container runtime, networking, storage, and an orchestration system. Both the standalone free Docker Engine (also known Docker Community Edition or Docker CE) and the commercial Docker Desktop originated from the Moby Project. However, Docker Desktop has evolved beyond the Moby Project, with a full product team investing in the features and technology to support individual developers, small teams, and the requirements of large development teams.

Docker Engine vs. Docker Desktop

Docker Desktop is a commercial product sold and supported by Docker, Inc. It includes the Docker Engine and other open source components; proprietary components; and features like an intuitive GUI, synchronized file shares, access to cloud resources, debugging features, native host integration, governance, and security features that support ECI, air-gapped containers, and administrative settings management. To provide a consistent user experience across different operating systems, Docker Desktop uses the host systems’ native virtualization to run and manage a VM for the Docker Engine. This offers developers a turnkey solution for running a containerization toolset on any device or operating system. Users can leverage the Docker Engine at its core on any platform by downloading Docker Desktop.

Docker Engine is a component free to download individually, not as part of Docker Desktop, and runs as a standalone for free. It can run on any supported Linux distribution and includes the Docker CLI to run commands. Docker Engine will not run natively on Windows or macOS and does not come with a GUI or any of the advanced features provided by Docker Desktop.

How can I tell If I’m running Docker Desktop or just the Docker Engine?

You can determine if you’re using Docker Desktop or Docker Engine in a number of different ways. The following section provides guidance for checking from the filesystem and from within the Docker CLI tooling, which is a component in Docker Desktop as well.

1. GUI or icon

If you are using Docker Desktop, you will have either a windowed GUI or a menubar/taskbar icon of a whale (Figure 1).

Screenshot of docker desktop menu on macos.
Figure 1: The macOS menu.

2. Check for an installation

The easiest way to check for Docker Desktop is to look for the installation; this can be automated by scripting or the use of an MDM solution.

Note that the following instructions assume that Docker Desktop is installed in the default location, which may result in false negatives if other installation paths are used.

Docker Desktop on macOS

On macOS, the Docker Desktop application is installed under the /Applications directory and is named Docker (Figure 2).

$ ls -alt /Applications/Docker.app/total 0drwxrwxr-x  49 root      admin  1568 Oct 13 09:54 ..drwxr-xr-x@  9 jschmidt  admin   288 Sep 28 15:36 Contentsdrwxr-xr-x@  3 jschmidt  admin    96 Sep  8 02:35 .
Screenshot of docker application information on macos, including date created, modified, version, and more.
Figure 2: Docker application installed on macOS.

Docker Desktop on Windows

On Windows, the Docker Desktop application is installed under the C:\Program Files folder and is named Docker (Figure 3).

C:\Users\qdzlug>dir "c:\Program Files\Docker" Volume in drive C has no label. Volume Serial Number is DEFE-FC15 Directory of c:\Program Files\Docker09/28/2023  02:22 PM    <DIR>          .09/28/2023  02:22 PM    <DIR>          ..09/28/2023  02:22 PM    <DIR>          cli-plugins09/28/2023  02:21 PM    <DIR>          Docker               0 File(s)              0 bytes               4 Dir(s)  52,964,356,096 bytes freeC:\Users\qdzlug>
Screenshot of docker application on windows, showing file folder and date modified.
Figure 3: Docker application installed on Windows.

Docker Desktop on Linux

On Linux, the Docker Desktop application is installed under /opt/docker-desktop.

$ ls -lat /opt/docker-desktop/total 208528drwxr-xr-x 7 root root      4096 Sep 29 10:58  .drwxr-xr-x 2 root root      4096 Sep 29 10:58  localesdrwxr-xr-x 5 root root      4096 Sep 29 10:58  resourcesdrwxr-xr-x 2 root root      4096 Sep 29 10:58  sharedrwxr-xr-x 2 root root      4096 Sep 29 10:58  linuxkitdrwxr-xr-x 2 root root      4096 Sep 29 10:58  bindrwxr-xr-x 7 root root      4096 Sep 29 10:57  ..-rw-r--r-- 1 root root   5313018 Sep 27 12:10  resources.pak-rw-r--r-- 1 root root    273328 Sep 27 12:10  snapshot_blob.bin-rw-r--r-- 1 root root    588152 Sep 27 12:10  v8_context_snapshot.bin-rw-r--r-- 1 root root       107 Sep 27 12:10  vk_swiftshader_icd.json-rw-r--r-- 1 root root    127746 Sep 27 12:10  chrome_100_percent.pak-rw-r--r-- 1 root root    179160 Sep 27 12:10  chrome_200_percent.pak-rwxr-xr-x 1 root root   1254728 Sep 27 12:10  chrome_crashpad_handler-rwxr-xr-x 1 root root     54256 Sep 27 12:10  chrome-sandbox-rw-r--r-- 1 root root       398 Sep 27 12:10  componentsVersion.json-rwxr-xr-x 1 root root 166000248 Sep 27 12:10 'Docker Desktop'-rw-r--r-- 1 root root  10544880 Sep 27 12:10  icudtl.dat-rwxr-xr-x 1 root root    252920 Sep 27 12:10  libEGL.so-rwxr-xr-x 1 root root   2877248 Sep 27 12:10  libffmpeg.so-rwxr-xr-x 1 root root   6633192 Sep 27 12:10  libGLESv2.so-rwxr-xr-x 1 root root   4623704 Sep 27 12:10  libvk_swiftshader.so-rwxr-xr-x 1 root root   6402632 Sep 27 12:10  libvulkan.so.1-rw-r--r-- 1 root root      1096 Sep 27 12:10  LICENSE.electron.txt-rw-r--r-- 1 root root   8328249 Sep 27 12:10  LICENSES.chromium.html

Note that the launch icon and location for Docker will depend on the Linux distribution being used.

3. Check a running installation

You can also check a running installation to determine which version of Docker is being used. To do this, you need to use the docker version command; the Server line will indicate the version being used.

Docker Desktop on macOS Arm64

The Server: Docker Desktop 4.24.0 (122432) line indicates using Docker Desktop.

$ docker versionClient: Cloud integration: v1.0.35+desktop.5 Version:           24.0.6 API version:       1.43 Go version:        go1.20.7 Git commit:        ed223bc Built:             Mon Sep  4 12:28:49 2023 OS/Arch:           darwin/arm64 Context:           default**Server: Docker Desktop 4.24.0 (122432)** Engine:  Version:          24.0.6  API version:      1.43 (minimum version 1.12)  Go version:       go1.20.7  Git commit:       1a79695  Built:            Mon Sep  4 12:31:36 2023  OS/Arch:          linux/arm64  Experimental:     true containerd:  Version:          1.6.22  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca runc:  Version:          1.1.8  GitCommit:        v1.1.8-0-g82f18fe docker-init:  Version:          0.19.0  GitCommit:        de40ad0

Docker Desktop on Windows

The Server: Docker Desktop 4.24.0 (122432) line indicates using Docker Desktop.

C:\Users\qdzlug>docker versionClient: Cloud integration: v1.0.35+desktop.5 Version:           24.0.6 API version:       1.43 Go version:        go1.20.7 Git commit:        ed223bc Built:             Mon Sep  4 12:32:48 2023 OS/Arch:           windows/amd64 Context:           default**Server: Docker Desktop 4.24.0 (122432)** Engine:  Version:          dev  API version:      1.44 (minimum version 1.12)  Go version:       go1.20.8  Git commit:       HEAD  Built:            Tue Sep 26 11:52:32 2023  OS/Arch:          linux/amd64  Experimental:     false containerd:  Version:          1.6.22  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca runc:  Version:          1.1.8  GitCommit:        v1.1.8-0-g82f18fe docker-init:  Version:          0.19.0  GitCommit:        de40ad0C:\Users\qdzlug>

Docker Desktop on Linux

The Server: Docker Desktop 4.31.0 (153195) line indicates using Docker Desktop.

Client: Version:           26.1.4 API version:       1.45 Go version:        go1.22.3 Git commit:        5650f9b102 Built:             Thu Jun  6 18:42:55 2024 OS/Arch:           linux/amd64 Context:           desktop-linuxServer: Docker Desktop 4.31.0 (153195) Engine:  Version:          26.1.4  API version:      1.45 (minimum version 1.24)  Go version:       go1.21.11  Git commit:       de5c9cf  Built:            Wed Jun  5 11:29:22 2024  OS/Arch:          linux/amd64  Experimental:     false containerd:  Version:          1.6.33  GitCommit:        d2d58213f83a351ca8f528a95fbd145f5654e957 runc:  Version:          1.1.12  GitCommit:        v1.1.12-0-g51d5e94 docker-init:  Version:          0.19.0  GitCommit:        de40ad0

Docker Engine on Linux

The Server: Docker Engine - Community line indicates using the community edition.

$ docker versionClient: Docker Engine - Community Cloud integration: v1.0.35+desktop.5 Version:           24.0.6 API version:       1.43 Go version:        go1.20.7 Git commit:        ed223bc Built:             Mon Sep  4 12:31:44 2023 OS/Arch:           linux/amd64 Context:           default**Server: Docker Engine - Community** Engine:  Version:          24.0.6  API version:      1.43 (minimum version 1.12)  Go version:       go1.20.7  Git commit:       1a79695  Built:            Mon Sep  4 12:31:44 2023  OS/Arch:          linux/amd64  Experimental:     true containerd:  Version:          1.6.24  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc:  Version:          1.1.9  GitCommit:        v1.1.9-0-gccaecfc docker-init:  Version:          0.19.0  GitCommit:        de40ad0

Docker contexts

Note that multiple contexts can be installed on a system; this is most often seen in Linux where Docker Desktop and Docker Engine are installed on the same host. To switch between the two, the docker context use command is used. When you are in a context, you communicate with the daemon for that context; thus, in a dual installation situation, you would be switching between the Docker Desktop install and the host install.

To view contexts, you use docker context ls, then switch via docker context use CONTEXTNAME. The following example shows a Linux system with both installed.

$ docker context lsNAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                     KUBERNETES ENDPOINT   ORCHESTRATORdefault *           moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                     desktop-linux       moby                Docker Desktop                            unix:///home/jschmidt/.docker/desktop/docker.sock               $ docker versionClient: Docker Engine - Community Cloud integration: v1.0.35+desktop.5 Version:           24.0.6 API version:       1.43 Go version:        go1.20.7 Git commit:        ed223bc Built:             Mon Sep  4 12:31:44 2023 OS/Arch:           linux/amd64 Context:           defaultServer: Docker Engine - Community Engine:  Version:          24.0.6  API version:      1.43 (minimum version 1.12)  Go version:       go1.20.7  Git commit:       1a79695  Built:            Mon Sep  4 12:31:44 2023  OS/Arch:          linux/amd64  Experimental:     true containerd:  Version:          1.6.24  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc:  Version:          1.1.9  GitCommit:        v1.1.9-0-gccaecfc docker-init:  Version:          0.19.0  GitCommit:        de40ad0$ docker context use desktop-linuxdesktop-linuxCurrent context is now "desktop-linux"$ docker versionClient: Docker Engine - Community Cloud integration: v1.0.35+desktop.5 Version:           24.0.6 API version:       1.43 Go version:        go1.20.7 Git commit:        ed223bc Built:             Mon Sep  4 12:31:44 2023 OS/Arch:           linux/amd64 Context:           desktop-linuxServer: Docker Desktop 4.24.0 (122432) Engine:  Version:          24.0.6  API version:      1.43 (minimum version 1.12)  Go version:       go1.20.7  Git commit:       1a79695  Built:            Mon Sep  4 12:32:16 2023  OS/Arch:          linux/amd64  Experimental:     false containerd:  Version:          1.6.22  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca runc:  Version:          1.1.8  GitCommit:        v1.1.8-0-g82f18fe docker-init:  Version:          0.19.0  GitCommit:        de40ad0

Other OCI tooling

Because both Docker Engine and Docker Desktop are OCI compliant, a number of solutions are presented and installed as “direct replacements” for Docker. This process usually involves creating helper aliases, scripts, or batch programs to emulate docker commands.

You can check for aliases by running the command alias docker to see if there is an alias in place. This holds true for Linux and macOS, or a Linux distribution inside WSL2 on Windows.

$ alias docker # Docker aliased to podmandocker='podman'$ alias docker # No alias present

You can also list the docker binary from the CLI to ensure that it is the official Docker binary:

$ ls -l `which docker` # Docker supplied by Homebrew on the Maclrwxr-xr-x  1 jschmidt  admin  34 Apr  2 12:03 /opt/homebrew/bin/docker -> ../Cellar/docker/26.0.0/bin/docker$ ls -l `which docker` # Official Docker binary on the Maclrwxr-xr-x  1 root  wheel  54 Jan 10 16:06 /usr/local/bin/docker -> /Applications/Docker.app/Contents/Resources/bin/docker

Conclusion

To wrap up our exploration, note that there are also several offerings generically referred to as “Docker” available to use as part of your containerization journey. This post focused on Docker Engine and Docker Desktop.

At this point, you should be comfortable distinguishing between a Docker Desktop installation and a Docker Engine installation and be able to identify when other OCI tooling is being used under the docker command name. You should also have a high-level understanding of Docker contexts as they relate to this topic. Finally, you should be able to review your usage against the Docker Licensing Agreement to ensure compliance or simply log in with your company credentials to get access to your procured entitlements..

Learn more