translate install/debian.md

pull/470/head
Dorsey.Xu 2020-10-26 13:54:27 +08:00
parent f4e21a70b1
commit cc8c36b1a3
2 changed files with 36 additions and 37 deletions

View File

@ -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 supports the following [Debian](https://www.debian.org/intro/about) versions.
Docker CE [Debian](https://www.debian.org/intro/about) 操作系统:
* Buster 10 * Buster 10
* Stretch 9 * 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 ```bash
$ sudo apt-get remove docker \ $ sudo apt-get remove docker \
@ -21,9 +20,9 @@ $ sudo apt-get remove docker \
docker.io 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 ```bash
$ sudo apt-get update $ sudo apt-get update
@ -37,19 +36,19 @@ $ sudo apt-get install \
software-properties-common 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 ```bash
$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add - $ 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 - # $ 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 ```bash
$ sudo add-apt-repository \ $ sudo add-apt-repository \
@ -57,18 +56,18 @@ $ sudo add-apt-repository \
$(lsb_release -cs) \ $(lsb_release -cs) \
stable" stable"
# # Official source
# $ sudo add-apt-repository \ # $ sudo add-apt-repository \
# "deb [arch=amd64] https://download.docker.com/linux/debian \ # "deb [arch=amd64] https://download.docker.com/linux/debian \
# $(lsb_release -cs) \ # $(lsb_release -cs) \
# stable" # 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 ```bash
$ sudo apt-get update $ sudo apt-get update
@ -76,43 +75,43 @@ $ sudo apt-get update
$ sudo apt-get install docker-ce $ 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 ```bash
$ curl -fsSL get.docker.com -o get-docker.sh $ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun $ 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 ```bash
$ sudo systemctl enable docker $ sudo systemctl enable docker
$ sudo systemctl start 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 ```bash
$ sudo groupadd docker $ sudo groupadd docker
``` ```
`docker` add current user to `docker` group:
```bash ```bash
$ sudo usermod -aG docker $USER $ sudo usermod -aG docker $USER
``` ```
退 Exit current terminal and relogin to test.
### Docker ### Test whether Docker is installed correctly
```bash ```bash
$ docker run hello-world $ docker run hello-world
@ -145,12 +144,12 @@ For more examples and ideas, visit:
https://docs.docker.com/get-started/ 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/)

View File

@ -2,7 +2,7 @@
> warning: Don't install Docker CE directly using apt without configuring Docker APT source. > warning: Don't install Docker CE directly using apt without configuring Docker APT source.
### Preparation ### Prerequisites
#### System requirements #### System requirements
@ -97,9 +97,9 @@ $ sudo systemctl enable docker
$ sudo systemctl start 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: create `docker` group:
@ -152,7 +152,7 @@ If it shows above message, it means your installation is successful.
### Registry Mirror(In China) ### 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 ### References