Table of contents
foreword
- TencentOS Server 3.1 (fully compatible with CentOS 8 user mode, supporting the deeply optimized tkernel4 version based on the community 5.4 LTS kernel)
Install docker-ce
-
Uninstall the old version first, without skipping the old version
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
-
Install yum-utils
yum install -y yum-utils
-
Add docker-ce.repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
PS: Replace the Docker CE warehouse image (or not)
-
install latest version
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
-
view version
docker -v
-
start docker
systemctl start docker
-
Run the hello-world image
docker run hello-world
Set up the Docker Hub image cache
-
Set up Docker Hub image cache
For systems using systemd (Ubuntu 16.04+, Debian 8+, CentOS 7), add to the configuration file /etc/docker/daemon.json:{ "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] }
Restart dockerd:
systemctl restart docker
-
Check whether the Docker Hub image cache is valid.
If you see the following content in the result, the configuration is successful.
shell> docker info
Client: Docker Engine - Community
Version: 24.0.4
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.19.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
scan: Docker Scan (Docker Inc.)
Version: v0.21.0
Path: /usr/libexec/docker/cli-plugins/docker-scan
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 24.0.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
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 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version: v1.1.7-0-g860f061
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 5.4.119-19-0009.11
Operating System: TencentOS Server 3.1 (Final)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.393GiB
Name: VM-32-4-tencentos
ID: ec17c509-a153-4e2f-945e-22dcf02d5732
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://docker.mirrors.ustc.edu.cn/
Live Restore Enabled: false
- yes
reference
https://docs.docker.com/engine/install/centos/
https://mirrors.ustc.edu.cn/help/dockerhub.html
https://mirrors.ustc.edu.cn/