docs: update docker/install
This commit is contained in:
parent
2871db45ea
commit
2b2b5a6aec
@ -2,7 +2,7 @@
|
|||||||
title: docker的安装卸载
|
title: docker的安装卸载
|
||||||
description: docker的安装与卸载
|
description: docker的安装与卸载
|
||||||
published: true
|
published: true
|
||||||
date: 2021-09-09T01:36:54.122Z
|
date: 2021-12-09T06:34:53.251Z
|
||||||
tags: docker
|
tags: docker
|
||||||
editor: markdown
|
editor: markdown
|
||||||
dateCreated: 2021-08-02T07:22:52.894Z
|
dateCreated: 2021-08-02T07:22:52.894Z
|
||||||
@ -51,16 +51,94 @@ $ yum list installed |grep docker
|
|||||||
|
|
||||||
旧版本安装
|
旧版本安装
|
||||||
- containerd.io-1.2.5-3.1.el7.x86_64.rpm
|
- containerd.io-1.2.5-3.1.el7.x86_64.rpm
|
||||||
- docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
|
- docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
|
||||||
- docker-ce-cli-18.09.4-3.el7.x86_64.rpm
|
- docker-ce-cli-18.09.4-3.el7.x86_64.rpm
|
||||||
- docker-ce-18.09.4-3.el7.x86_64.rpm
|
- docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
|
||||||
|
|
||||||
###### 执行安装
|
###### 执行安装
|
||||||
```bash
|
```bash
|
||||||
$ yum install -y docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
|
$ yum install -y docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
|
||||||
|
|
||||||
$ yum install -y docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
|
$ yum install -y docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 离线安装
|
||||||
|
|
||||||
|
环境:contos7.3(内核需为3.10+)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat /etc/redhat-release
|
||||||
|
# CentOS Linux release 7.3.1611 (Core)
|
||||||
|
```
|
||||||
|
|
||||||
|
[安装包传送门](https://download.docker.com/linux/static/stable/x86_64/)
|
||||||
|
|
||||||
|
这里下载的版本是:docker-19.03.9.tgz
|
||||||
|
|
||||||
|
1. 解压与安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /usr/local/resource/docker
|
||||||
|
tar -xzvf docker-18.06.3-ce.tar
|
||||||
|
# 将二进制文件移动到bin下
|
||||||
|
mv /usr/local/resource/docker/docker/* /usr/bin/
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 编写 docker.service
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vim /etc/systemd/system/docker.service
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 将以下内容粘贴进去:
|
||||||
|
|
||||||
|
```service
|
||||||
|
[Unit]
|
||||||
|
Description=Docker Application Container Engine
|
||||||
|
Documentation=https://docs.docker.com
|
||||||
|
After=network-online.target firewalld.service
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=notify
|
||||||
|
# the default is not to use systemd for cgroups because the delegate issues still
|
||||||
|
# exists and systemd currently does not support the cgroup feature set required
|
||||||
|
# for containers run by docker
|
||||||
|
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
|
||||||
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
# Having non-zero Limit*s causes performance problems due to accounting overhead
|
||||||
|
# in the kernel. We recommend using cgroups to do container-local accounting.
|
||||||
|
LimitNOFILE=infinity
|
||||||
|
LimitNPROC=infinity
|
||||||
|
LimitCORE=infinity
|
||||||
|
# Uncomment TasksMax if your systemd version supports it.
|
||||||
|
# Only systemd 226 and above support this version.
|
||||||
|
#TasksMax=infinity
|
||||||
|
TimeoutStartSec=0
|
||||||
|
# set delegate yes so that systemd does not reset the cgroups of docker containers
|
||||||
|
Delegate=yes
|
||||||
|
# kill only the docker process, not all processes in the cgroup
|
||||||
|
KillMode=process
|
||||||
|
# restart the docker process if it exits prematurely
|
||||||
|
Restart=on-failure
|
||||||
|
StartLimitBurst=3
|
||||||
|
StartLimitInterval=60s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
4. 授予执行权限
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x /etc/systemd/system/docker.service
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 重载service
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl daemon-reload
|
||||||
|
```
|
||||||
|
|
||||||
#### 启动docker
|
#### 启动docker
|
||||||
设置开机启动
|
设置开机启动
|
||||||
```bash
|
```bash
|
||||||
|
Loading…
Reference in New Issue
Block a user