目录
- 前言
- 安装 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 - CommunityVersion: 24.0.4Context: defaultDebug Mode: falsePlugins:buildx: Docker Buildx (Docker Inc.)Version: v0.11.1Path: /usr/libexec/docker/cli-plugins/docker-buildxcompose: Docker Compose (Docker Inc.)Version: v2.19.1Path: /usr/libexec/docker/cli-plugins/docker-composescan: Docker Scan (Docker Inc.)Version: v0.21.0Path: /usr/libexec/docker/cli-plugins/docker-scanServer:Containers: 1Running: 0Paused: 0Stopped: 1Images: 2Server Version: 24.0.4Storage Driver: overlay2Backing Filesystem: extfsSupports d_type: trueUsing metacopy: falseNative Overlay Diff: trueuserxattr: falseLogging Driver: json-fileCgroup Driver: cgroupfsCgroup Version: 1Plugins:Volume: localNetwork: bridge host ipvlan macvlan null overlayLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: io.containerd.runc.v2 runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8runc version: v1.1.7-0-g860f061init version: de40ad0Security Options:seccompProfile: builtinKernel Version: 5.4.119-19-0009.11Operating System: TencentOS Server 3.1 (Final)OSType: linuxArchitecture: x86_64CPUs: 2Total Memory: 7.393GiBName: VM-32-4-tencentosID: ec17c509-a153-4e2f-945e-22dcf02d5732Docker Root Dir: /var/lib/dockerDebug Mode: falseExperimental: falseInsecure Registries:127.0.0.0/8Registry 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/