部署环境: 操作系统:CentOS 7 Docker环境依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
配置国内Docker-ce yum源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装Docker程序
[root@centos7 ~]
docker-ce-cli -- docker命令行工具包
containerd.io -- 容器接口相关包
启动Docker 并将服务加载到自动启动项
systemctl start docker && systemctl enable docker
查看Docker版本信息
docker version
查看Docker运行信息
docker info
[root@centos7 ~]
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
scan: Docker Scan (Docker Inc., v0.8.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.7
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.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: e25210fe30a0a703442421b0f60afac609f950a3
runc version: v1.0.1-0-g4144b63
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.79GiB
Name: centos7
ID: BHJ4:X6ND:J23A:64TD:GEAN:3OZZ:YYVF:6PDB:DI2Y:R45K:BAL7:A3W5
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
搜索Centos 镜像
[root@centos7 ~]
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 6669 [OK]
ansible/centos7-ansible Ansible on Centos7 134 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 129 [OK]
jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 118 [OK]
centos/systemd systemd enabled base container. 101 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 91
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 58 [OK]
tutum/centos Simple CentOS docker image with SSH access 48
jdeathe/centos-ssh-apache-php Apache PHP - CentOS. 31 [OK]
kinogmt/centos-ssh CentOS with SSH 29 [OK]
guyton/centos6 From official centos6 container with full up… 10 [OK]
nathonfowlie/centos-jre Latest CentOS image with the JRE pre-install… 8 [OK]
centos/tools Docker image that has systems administration… 7 [OK]
drecom/centos-ruby centos ruby 6 [OK]
mamohr/centos-java Oracle Java 8 Docker image based on Centos 7 3 [OK]
darksheer/centos Base Centos Image -- Updated hourly 3 [OK]
miko2u/centos6 CentOS6 日本語環境 2 [OK]
dokken/centos-7 CentOS 7 image for kitchen-dokken 2
indigo/centos-maven Vanilla CentOS 7 with Oracle Java Developmen… 2 [OK]
amd64/centos The official build of CentOS. 2
mcnaughton/centos-base centos base image 1 [OK]
blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]
myheritage/centos7-git-java CentOs based docker image for Jenkins slave 1 [OK]
smartentry/centos centos with smartentry 0 [OK]
starlabio/centos-native-build Our CentOS image for native builds 0 [OK]
下载Docker centos镜像
docker pull centos
修改Docker 镜像加速器,提升pull的速度 登录 https://cr.console.aliyun.com 配置镜像加速器:
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://s7cngrav.mirror.aliyuncs.com","https://docker.mirrors.ustc.edu.cn/","https://hub-mirror.c.163.com/","https://reg-mirror.qiniu.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
配置docker路由策略
vim /etc/sysctl.d/99-sysctl.conf
net.ipv4.ip_forward = 1
|