目录
- 前言
- 安装 docker-ce
- 设置Docker Hub 镜像缓存
- 参考
前言
- TencentOS Server 3.1(与 CentOS 8用户态完全兼容,配套基于社区5.4 LTS 内核深度优化的 tkernel4版本)
安装 docker-ce
-
先卸载老版本,没有老版本的跳过
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
-
安装 yum-utils
yum install -y yum-utils
-
添加docker-ce.repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
PS:更换 Docker CE 仓库镜像 (也可以不更换)
-
安装最新版本
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
-
查看版本
docker -v
-
启动docker
systemctl start docker
-
运行 hello-world 镜像
docker run hello-world
设置Docker Hub 镜像缓存
-
设置 Docker Hub 镜像缓存
对于使用 systemd 的系统(Ubuntu 16.04+、Debian 8+、CentOS 7), 在配置文件 /etc/docker/daemon.json 中加入:{ "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] }
重新启动 dockerd:
systemctl restart docker
-
检查Docker Hub 镜像缓存是否生效
如果从结果中看到了如下内容,说明配置成功。
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
- 是
参考
https://docs.docker.com/engine/install/centos/
https://mirrors.ustc.edu.cn/help/dockerhub.html
https://mirrors.ustc.edu.cn/