离线安装Docker

离线安装Docker

环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
#cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

安装包

  • containerd.io-1.5.11-3.1.el7.x86_64.rpm
  • container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm
  • docker-ce-20.10.9-3.el7.x86_64.rpm
  • docker-ce-cli-20.10.9-3.el7.x86_64.rpm
  • docker-ce-rootless-extras-20.10.9-3.el7.x86_64.rpm
  • docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
  • docker-compose-plugin-2.3.3-3.el7.x86_64.rpm
  • docker-scan-plugin-0.9.0-3.el7.x86_64.rpm
  • fuse3-libs-3.6.1-4.el7.x86_64.rpm
  • fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
  • slirp4netns-0.4.3-4.el7_8.x86_64.rpm

安装

1
rpm -i *.rpm

配置docker

vim /etc/docker/daemon.json

1
2
3
4
5
6
7
8
9
10
11
12
{
"data-root":"/data/app-data/docker",
"insecure-registries": ["192.168.0.149:8082","192.168.0.149:8084"],
"registry-mirrors": [
"http://192.168.0.149:8084"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "10g",
"max-file": "1"
}
}

重启docker

1
sudo systemctl restart docker

配置当前用户访问权限

1
2
3
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
compose: Docker Compose (Docker Inc., v2.3.3)
scan: Docker Scan (Docker Inc., v0.9.0)

Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.9
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc version: v1.0.3-0-gf46b6ba
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 48
Total Memory: 62.51GiB
Name: localhost.localdomain
ID: KYKT:JPKP:4LEE:THJ4:RXUG:LNDT:CZQL:4O5I:VUXP:VRXI:3B5O:6E5D
Docker Root Dir: /data/app-data/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
192.168.0.149:8082
192.168.0.149:8084
127.0.0.0/8
Registry Mirrors:
http://192.168.0.149:8084/
Live Restore Enabled: false

参考

  1. Docker 安装包下载地址
  2. Docker 安装包依赖下载地址