mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-12-26 15:06:18 +00:00
translate install/debian.md
This commit is contained in:
parent
f4e21a70b1
commit
cc8c36b1a3
@ -1,19 +1,18 @@
|
||||
## Debian 安装 Docker CE
|
||||
## Install Docker CE on Debian
|
||||
> WARNING: DO NOT install Docker with apt directly without configuring apt source.
|
||||
|
||||
>警告:切勿在没有配置 Docker APT 源的情况下直接使用 apt 命令安装 Docker.
|
||||
### Prerequisites
|
||||
|
||||
### 准备工作
|
||||
#### OS Requirement
|
||||
|
||||
#### 系统要求
|
||||
|
||||
Docker CE 支持以下版本的 [Debian](https://www.debian.org/intro/about) 操作系统:
|
||||
Docker CE supports the following [Debian](https://www.debian.org/intro/about) versions.
|
||||
|
||||
* Buster 10
|
||||
* Stretch 9
|
||||
|
||||
#### 卸载旧版本
|
||||
#### Uninstall the Old Versions
|
||||
|
||||
旧版本的 Docker 称为 `docker` 或者 `docker-engine`,使用以下命令卸载旧版本:
|
||||
The old versions of Docker are called `docker` or `docker-engine`, you can have them uninstalled with the following command:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get remove docker \
|
||||
@ -21,9 +20,9 @@ $ sudo apt-get remove docker \
|
||||
docker.io
|
||||
```
|
||||
|
||||
### 使用 APT 安装
|
||||
### Install with apt
|
||||
|
||||
由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书。
|
||||
Since the apt source uses HTTPS to make sure that the software is not modified maliciously during download, we have to add the apt source via HTTPS as well as the CA certificate.
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update
|
||||
@ -37,19 +36,19 @@ $ sudo apt-get install \
|
||||
software-properties-common
|
||||
```
|
||||
|
||||
鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。
|
||||
Due to the network issues in China mainland, it is highly recommended for Chinese users to use Chinese sources. Please refer to the official sources in the comments(they are replaced by a Chinese source).
|
||||
|
||||
为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥。
|
||||
To verify the validity of the package downloaded, we have to add the GPG key for the package source.
|
||||
|
||||
```bash
|
||||
$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
|
||||
|
||||
|
||||
# 官方源
|
||||
# Official source
|
||||
# $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
|
||||
```
|
||||
|
||||
然后,我们需要向 `source.list` 中添加 Docker CE 软件源:
|
||||
After that, we need to add the Docker CE source to `source.list`:
|
||||
|
||||
```bash
|
||||
$ sudo add-apt-repository \
|
||||
@ -57,18 +56,18 @@ $ sudo add-apt-repository \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
# 官方源
|
||||
# Official source
|
||||
# $ sudo add-apt-repository \
|
||||
# "deb [arch=amd64] https://download.docker.com/linux/debian \
|
||||
# $(lsb_release -cs) \
|
||||
# stable"
|
||||
```
|
||||
|
||||
>以上命令会添加稳定版本的 Docker CE APT 源,如果需要测试或每日构建版本的 Docker CE 请将 stable 改为 test 或者 nightly。
|
||||
> The above commands will add the APT source for the stable version of Docker CE. If you need the `test` or `nightly` source, please replace with them to meet your own needs.
|
||||
|
||||
#### 安装 Docker CE
|
||||
#### Install Docker CE
|
||||
|
||||
更新 apt 软件包缓存,并安装 `docker-ce`。
|
||||
Update apt cache and install `docker-ce`
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update
|
||||
@ -76,43 +75,43 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install docker-ce
|
||||
```
|
||||
|
||||
### 使用脚本自动安装
|
||||
### Install with Automatic Scripts
|
||||
|
||||
在测试或开发环境中 Docker 官方为了简化安装流程,提供了一套便捷的安装脚本,Debian 系统上可以使用这套脚本安装:
|
||||
To simplify the installation process during test or development, Docker official provides a convenient installation script, you can install docker on Debian with the following script:
|
||||
|
||||
```bash
|
||||
$ curl -fsSL get.docker.com -o get-docker.sh
|
||||
$ sudo sh get-docker.sh --mirror Aliyun
|
||||
```
|
||||
|
||||
执行这个命令后,脚本就会自动的将一切准备工作做好,并且把 Docker CE 的 Edge 版本安装在系统中。
|
||||
After execution, the script will have everything prepared, and install the stable version on your OS.
|
||||
|
||||
### 启动 Docker CE
|
||||
### Start Docker CE
|
||||
|
||||
```bash
|
||||
$ sudo systemctl enable docker
|
||||
$ sudo systemctl start docker
|
||||
```
|
||||
|
||||
### 建立 docker 用户组
|
||||
### Add Docker Usergroups
|
||||
|
||||
默认情况下,`docker` 命令会使用 [Unix socket](https://en.wikipedia.org/wiki/Unix_domain_socket) 与 Docker 引擎通讯。而只有 `root` 用户和 `docker` 组的用户才可以访问 Docker 引擎的 Unix socket。出于安全考虑,一般 Linux 系统上不会直接使用 `root` 用户。因此,更好地做法是将需要使用 `docker` 的用户加入 `docker` 用户组。
|
||||
Command `docker` uses [Unix socket](https://en.wikipedia.org/wiki/Unix_domain_socket) to communicate with Docker engine by default. Only users of `root` and `docker` groups can communicate with Unix socket of the Docker engine.`root` user is not directly used on Linux systems in general for security. Therefore, it is better to add users who need to use `docker` to the `docker` user group.
|
||||
|
||||
建立 `docker` 组:
|
||||
create `docker` group:
|
||||
|
||||
```bash
|
||||
$ sudo groupadd docker
|
||||
```
|
||||
|
||||
将当前用户加入 `docker` 组:
|
||||
add current user to `docker` group:
|
||||
|
||||
```bash
|
||||
$ sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
退出当前终端并重新登录,进行如下测试。
|
||||
Exit current terminal and relogin to test.
|
||||
|
||||
### 测试 Docker 是否安装正确
|
||||
### Test whether Docker is installed correctly
|
||||
|
||||
```bash
|
||||
$ docker run hello-world
|
||||
@ -145,12 +144,12 @@ For more examples and ideas, visit:
|
||||
https://docs.docker.com/get-started/
|
||||
```
|
||||
|
||||
若能正常输出以上信息,则说明安装成功。
|
||||
If it shows above message, it means your installation is successful.
|
||||
|
||||
### 镜像加速
|
||||
### Registry Mirror(In China)
|
||||
|
||||
如果在使用过程中发现拉取 Docker 镜像十分缓慢,可以配置 Docker [国内镜像加速](mirror.md)。
|
||||
If you pull docker images very slowly, then you can configure [Registry Mirror](mirror.md).
|
||||
|
||||
### 参考文档
|
||||
### References
|
||||
|
||||
* [Docker 官方 Debian 安装文档](https://docs.docker.com/install/linux/docker-ce/debian/)
|
||||
* [Docker Oficial Debian Installation Documents](https://docs.docker.com/install/linux/docker-ce/debian/)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
> warning: Don't install Docker CE directly using apt without configuring Docker APT source.
|
||||
|
||||
### Preparation
|
||||
### Prerequisites
|
||||
|
||||
#### System requirements
|
||||
|
||||
@ -97,9 +97,9 @@ $ sudo systemctl enable docker
|
||||
$ sudo systemctl start docker
|
||||
```
|
||||
|
||||
### Add docker user group
|
||||
### Add Docker Usergroups
|
||||
|
||||
Command `docker` uses [Unix socket](https://en.wikipedia.org/wiki/Unix_domain_socket) to communicate with Docker engine default. Only users of `root` and `docker` groups can communicate with Unix socket of Docker engine.`root` user is not directly used on Linux systems in general for security. Therefore, it is better to add users who need to use `docker` to the `docker` user group.
|
||||
Command `docker` uses [Unix socket](https://en.wikipedia.org/wiki/Unix_domain_socket) to communicate with Docker engine by default. Only users of `root` and `docker` groups can communicate with Unix socket of the Docker engine.`root` user is not directly used on Linux systems in general for security. Therefore, it is better to add users who need to use `docker` to the `docker` user group.
|
||||
|
||||
create `docker` group:
|
||||
|
||||
@ -152,7 +152,7 @@ If it shows above message, it means your installation is successful.
|
||||
|
||||
### Registry Mirror(In China)
|
||||
|
||||
If you pull docker images very slowly, then you can configurate [Registry Mirror](mirror.md).
|
||||
If you pull docker images very slowly, then you can configure [Registry Mirror](mirror.md).
|
||||
|
||||
### References
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user