非常教程

Docker 17参考手册

引擎 | Engine

Fedora (Engine)

要开始使用 Fedora 上的 Docker CE,请确保满足先决条件,然后安装 Docker。

先决条件

Docker EE客户

Docker EE 在 Fedora 上不受支持。有关不同 Docker 版本支持的操作系统和发行版的列表,请参阅 Docker变体。

OS要求

要安装 Docker,您需要这些 Fedora 版本的64位版本:

  • 二十四
  • 二十五
  • 二十六

注意:Fedora 26软件包目前仅在边缘测试存储库中可用。

卸载旧版本

老版本的 Docker 被称为dockerdocker-engine。如果安装了它们,请卸载它们以及相关的依赖项。

$ sudo dnf remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

如果dnf报告说没有安装这些软件包,那就行了。

/var/lib/docker/包括图像,容器,卷和网络的内容将被保留。现在调用 Docker CE 包docker-ce

安装Docker CE

您可以根据您的需要以不同的方式安装 Docker CE:

  • 大多数用户设置 Docker 的存储库并从中进行安装,以便安装和升级任务。这是推荐的方法。
  • 有些用户下载 RPM 软件包并手动安装,并完全手动管理升级。这对于在无法访问互联网的空隙系统上安装 Docker 等情况很有用。
  • 在测试和开发环境中,有些用户选择使用自动便利脚本来使用存储库安装 Docker.Install。首次在新主机上安装 Docker CE 之前,需要设置 Docker 存储库。之后,您可以从存储库安装和更新 Docker CE。设置存储库
  • dnf-plugins-core从命令行安装提供命令来管理 DNF 存储库的软件包。

$ sudo dnf -y安装dnf-plugins-core

  1. 使用以下命令设置稳定的存储库。即使您想从边缘测试存储库安装构建,也总是需要稳定的存储库。$ sudo dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repo
  1. 可选:启用边缘测试存储库。这些存储库包含在上述docker.repo文件中,但默认情况下处于禁用状态。您可以将它们与稳定的存储库一起启用。

注意:Fedora 26软件包目前仅在边缘测试存储库中可用。

$ sudo dnf config-manager --set-enabled docker-ce-edge

$ sudo dnf config-manager --set-enabled docker-ce-test

您可以通过使用该标志运行命令来禁用边缘测试存储库。要重新启用它,请使用标志。以下命令禁用边缘存储库。dnf config-manager--disable--enable

$ sudo dnf config-manager --set-disabled docker-ce-edge

注意:从Docker 17.06开始,稳定版本也被推到边缘测试版本库。

了解稳定边缘频道。

安装Docker CE

  1. 更新dnf软件包索引。$ sudo dnf makecache fast如果这是自添加Docker存储库以来首次刷新包索引,系统将提示您接受GPG密钥,并显示密钥的指纹。验证指纹是否匹配060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35,如果是,请接受密钥。
  1. 安装最新版本的 Docker CE,或转到下一步安装特定版本。

$ sudo dnf安装docker-ce

有多个Docker存储库?

如果启用了多个 Docker 存储库,则安装或更新时未指定版本dnf installdnf update命令将始终安装尽可能高的版本,这可能不适合您的稳定性需求。

  1. 在生产系统上,您应该安装特定版本的Docker CE,而不是始终使用最新版本。列出可用的版本。此示例使用该sort -r命令按版本号对结果进行排序,从最高到最低并被截断。 注意:该dnf list命令仅显示二进制包。要显示源包,请.x86_64从包名中省略。$ dnf list docker-ce.x86_64 --showduplicates | sort -r docker-ce.x86_64 17.06.0.fc24 docker-ce-stable列表的内容取决于启用了哪些存储库,并且将针对您的Fedora版本(由.fc24本例中的版本后缀)。选择一个特定的版本进行安装。第二列是版本字符串。第三列是存储库名称,它指示软件包来自哪个存储库并且通过扩展其稳定性级别。要安装特定版本,请将版本字符串附加到包名称并用连字符(-)分隔它们:$ sudo dnf -y install docker-ce- <VERSION>
  1. 启动Docker。

$ sudo systemctl启动docker

  1. 通过运行hello-world映像验证是否正确安装了Docker CE 。$ sudo docker run hello-world这个命令下载一个测试图像并在容器中运行它。当容器运行时,它会打印一条信息消息并退出.Docker CE已安装并正在运行。您需要使用sudo运行Docker命令。继续Linux postinstall以允许非特权用户运行Docker命令以及其他可选配置步骤。升级Docker CETo升级Docker CE,首先运行sudo dnf makecache fast,然后按照安装说明选择要安装的新版本。从package安装.Ifall你不能使用Docker的仓库来安装Docker,你可以下载.rpm文件供您发布并手动安装。每次要升级Docker CE时,都需要下载一个新文件。
  1. 转到https://download.docker.com/linux/fedora/并选择您的Fedora版本。转到x86_64/stable/Packages/并下载.rpm您想要安装的Docker版本的文件。

注意:要安装边缘软件包,stable请将URL中的单词更改为edge

  1. 安装Docker CE,将下面的路径更改为您下载Docker软件包的路径。$ sudo dnf -y install /path/to/package.rpm
  1. 启动Docker。

$ sudo systemctl启动docker

  1. Verify that Docker CE is installed correctly by running the hello-world image. $ sudo docker run hello-world This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.Docker CE is installed and running. You need to use sudo to run Docker commands. Continue to Post-installation steps for Linux to allow non-privileged users to run Docker commands and for other optional configuration steps.Upgrade Docker CETo upgrade Docker CE, download the newer package file and repeat the installation procedure, using dnf -y upgrade instead of dnf -y install, and pointing to the new file.Install using the convenience scriptDocker provides convenience scripts at get.docker.com and test.docker.com用于快速和非交互式地将Docker CE的稳定版和测试版安装到开发环境中。脚本的源代码位于docker-install存储库中。不建议在生产环境中使用这些脚本,并且在使用它们之前应了解其潜在风险:
  1. 脚本需要rootsudo权限才能运行。因此,在运行脚本之前,应仔细检查和审核脚本。
  1. 这些脚本会尝试检测您的 Linux 发行版和版本,并为您配置您的软件包管理系统。另外,这些脚本不允许您自定义任何安装参数。这可能会导致不支持的配置,无论是从 Docker 的角度还是从您自己的组织准则和标准。
  1. 这些脚本会安装包管理器的所有依赖关系和建议,而不要求确认。这可能会安装大量的包,具体取决于主机的当前配置。
  1. 如果 Docker 已经使用其他机制安装在主机上,请不要使用便捷脚本。

本示例使用get.docker.com上的脚本在 Linux 上安装 Docker CE 的最新稳定版本。要安装最新的测试版本,请改用test.docker.com。在下面的每个命令,取代每次出现gettest

警告:在本地运行之前,始终检查从互联网上下载的脚本。

$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

<output truncated>

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

Docker CE 已安装。它会自动启动DEB基于目录的分发。在RPM基于分布的情况下,您需要使用适当systemctlservice命令手动启动它。如消息所示,非root用户默认情况下无法运行 Docker 命令。

在使用便利脚本后升级 Docker

如果您使用便捷脚本安装 Docker,则应直接使用软件包管理器升级 Docker。重新运行便捷脚本没有任何优势,如果它试图重新添加已添加到主机的存储库,则会产生问题。

卸载Docker CE

  1. 卸载Docker包: $sudo df移除码头-ce
  1. 不会自动删除主机上的图像,容器,卷或自定义配置文件。删除所有图像,容器和卷:

$sudo rm-RF/var/lib/docker

您必须手动删除任何已编辑的配置文件。

下一步

  • 继续进行Linux的安装后步骤
  • 继续使用用户指南。

要求,apt,安装,fedora,rpm,安装,卸载,升级,更新

引擎 | Engine相关

1..NET核心应用程序(引擎) | .NET Core application (Engine)
2.关于图像,容器和存储驱动程序(引擎) | About images, containers, and storage drivers (Engine)
3.向swarm添加节点(Engine) | Add nodes to the swarm (Engine)
4.应用自定义元数据(引擎) | Apply custom metadata (Engine)
5.应用滚动更新(引擎) | Apply rolling updates (Engine)
6.apt-cacher-ng
7.编写Dockerfiles(引擎)的最佳实践 | Best practices for writing Dockerfiles (Engine)
8.二进制(引擎) | Binaries (Engine)
9.将容器端口绑定到主机(引擎) | Bind container ports to the host (Engine)
10.突破性变化(引擎) | Breaking changes (Engine)
11.建立自己的网桥 | Build your own bridge (Engine)
12.CentOS (Engine)
13.CentOS (Engine)
14.配置容器DNS(引擎) | Configure container DNS (Engine)
15.在用户定义的网络中配置容器DNS(引擎) | Configure container DNS in user-defined networks (Engine)
16.CouchDB (Engine)
17.创建基本映像(引擎) | Create a base image (Engine)
18.创建群(引擎) | Create a swarm (Engine)
19.自定义docker0网桥(引擎) | Customize the docker0 bridge (Engine)
20.Debian (Engine)
21.默认桥接网络 | Default bridge network
22.删除服务(引擎) | Delete the service (Engine)
23.部署服务(引擎) | Deploy a service (Engine)
24.将服务部署到一个群(引擎) | Deploy services to a swarm (Engine)
25.不推荐的引擎功能 | Deprecated Engine features
26.Docker容器网络(引擎) | Docker container networking (Engine)
27.Docker概述(引擎) | Docker overview (Engine)
28.Docker运行参考(引擎) | Docker run reference (Engine)
29.Dockerfile引用(引擎) | Dockerfile reference (Engine)
30.Dockerize应用程序 | Dockerize an application
31.排空节点(引擎) | Drain a node (Engine)
32.引擎 | Engine
33.FAQ(引擎) | FAQ (Engine)
34.开始 | Get started (Engine)
35.开始使用macvlan网络驱动程序 | Get started with macvlan network driver (Engine)
36.开始使用多主机网络 | Get started with multi-host networking (Engine)
37.节点如何工作 | How nodes work (Engine)
38.服务如何运作(引擎) | How services work (Engine)
39.图像管理 | Image management (Engine)
40.检查服务(引擎) | Inspect the service (Engine)
41.安装Docker(引擎) | Install Docker (Engine)
42.IPv6与Docker(引擎) | IPv6 with Docker (Engine)
43.将节点加入群集(引擎) | Join nodes to a swarm (Engine)
44.旧容器链接(引擎) | Legacy container links (Engine)
45.锁定你的群(引擎) | Lock your swarm (Engine)
46.管理群中的节点(引擎) | Manage nodes in a swarm (Engine)
47.使用Docker机密管理敏感数据(引擎) | Manage sensitive data with Docker secrets (Engine)
48.使用PKI管理swarm安全性(引擎) | Manage swarm security with PKI (Engine)
49.管理群体服务网络(引擎) | Manage swarm service networks (Engine)
50.迁移到引擎1.10 | Migrate to Engine 1.10
51.可选的Linux安装后步骤(引擎) | Optional Linux post-installation steps (Engine)
52.总览 | Overview (Engine)
53.总览 | Overview (Engine)
54.PostgreSQL(引擎) | PostgreSQL (Engine)
55.群集模式中的筏共识(引擎) | Raft consensus in swarm mode (Engine)
56.Riak (Engine)
57.以群集模式运行Docker Engine | Run Docker Engine in swarm mode
58.扩展服务(引擎) | Scale the service (Engine)
59.SDKs (Engine)
60.选择一个存储驱动 | Select a storage driver (Engine)
61.设置教程(引擎) | Set up for the tutorial (Engine)
62.SSHd (Engine)
63.存储驱动总览 | Storage driver overview (Engine)
64.存储服务配置数据(引擎) | Store service configuration data (Engine)
65.Swarm管理指南(引擎) | Swarm administration guide (Engine)
66.Swarm模式关键概念(引擎) | Swarm mode key concepts (Engine)
67.Swarm模式覆盖网络安全模型(引擎) | Swarm mode overlay network security model (Engine)
68.群模式概述(引擎) | Swarm mode overview (Engine)
69.Ubuntu (Engine)
70.Ubuntu (Engine)
71.了解容器通信(引擎) | Understand container communication (Engine)
72.使用多阶段构建(引擎) | Use multi-stage builds (Engine)
73.使用swarm模式路由网格(引擎) | Use swarm mode routing mesh (Engine)
74.使用AUFS存储驱动程序(引擎) | Use the AUFS storage driver (Engine)
75.使用Btrfs存储驱动程序(引擎) | Use the Btrfs storage driver (Engine)
76.使用设备映射器存储驱动程序(引擎) | Use the Device mapper storage driver (Engine)
77.使用OverlayFS存储驱动程序(引擎) | Use the OverlayFS storage driver (Engine)
78.使用VFS存储驱动程序(引擎) | Use the VFS storage driver (Engine)
79.使用ZFS存储驱动程序(引擎) | Use the ZFS storage driver (Engine)
80.处理图像 | Work with images
81.使用网络命令(引擎) | Work with network commands (Engine)
Docker 17

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

主页 https://docker.com/
源码 https://github.com/docker/docker
版本 17
发布版本 17.06