translate install/centos.md

pull/470/head
Dorsey.Xu 2020-10-26 14:47:10 +08:00
parent 27f495466d
commit 6c8e710c53
2 changed files with 36 additions and 38 deletions

View File

@ -1,16 +1,15 @@
## CentOS Docker CE
## Install Docker CE on CentOS
> Docker YUM 使 yum Docker.
> WARNING: DO NOT install Docker with yum directly without configuring yum source.
###
### Prerequisites
####
#### OS Requirement
Docker CE supports 64-bit version of CentOS 7, and it requires the kernel version to be no older than 3.10. CentOS 7 satisfies the minimum kernel version requirement. But due to the comparatively old kernel, some of the functionalities like `overlay2` are unable to be used, and some other features may be unstable.
Docker CE 64 CentOS 7 3.10 CentOS 7 `overlay2` 使
#### 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 yum remove docker \
@ -25,9 +24,9 @@ $ sudo yum remove docker \
docker-engine
```
### 使 yum
### Install with yum
Use the following commands to install the dependencies:
```bash
$ sudo yum install -y yum-utils \
@ -35,80 +34,79 @@ $ sudo yum install -y yum-utils \
lvm2
```
使
`yum`
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).
Use the following command to add `dnf` source.
```bash
$ sudo yum-config-manager \
--add-repo \
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
#
# Official source
# $ sudo yum-config-manager \
# --add-repo \
# https://download.docker.com/linux/centos/docker-ce.repo
```
Docker CE 使
If you want to use the `test` version of Docker CE, use the following command:
```bash
$ sudo yum-config-manager --enable docker-ce-test
```
Docker CE 使
As for `nightly` version:
```bash
$ sudo yum-config-manager --enable docker-ce-nightly
```
#### Docker CE
#### Install Docker CE
`yum` `docker-ce`
Update `yum` source cacheand then install `docker-ce`.
```bash
$ sudo yum makecache fast
$ sudo yum install docker-ce
```
### 使
### Install with Automatic Scripts
Docker 便CentOS 使
To simplify the installation process during test or development, Docker official provides a convenient installation script, you can install docker on Fedora 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 have installed 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
### Verify the Installation
```bash
$ docker run hello-world
@ -141,22 +139,22 @@ For more examples and ideas, visit:
https://docs.docker.com/get-started/
```
If it shows the 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).
###
### Add kernel Parameters
CentOS 使 Docker CE
If you see the following warnings when using Docker CE,
```bash
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
```
Please add the kernel parameters to enable these features.
```bash
$ sudo tee -a /etc/sysctl.conf <<-EOF
@ -165,12 +163,12 @@ net.bridge.bridge-nf-call-iptables = 1
EOF
```
`sysctl.conf`
Then reload the `sysctl.confg`
```bash
$ sudo sysctl -p
```
###
### References
* [Docker CentOS ](https://docs.docker.com/install/linux/docker-ce/centos/)
* [Docker Official Installation Documents for Fedora](https://docs.docker.com/install/linux/docker-ce/centos/)

View File

@ -167,4 +167,4 @@ If you pull docker images very slowly, then you can configure [Registry Mirror](
### References
* [Docker Official Installation Documents for Fedora](https://docs.docker.com/install/linux/docker-ce/fedora)
* [Docker Official Installation Documents for Fedora](https://docs.docker.com/install/linux/docker-ce/fedora)