Two ways
yum install epel-release
You can also replace 清华源
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
sudo yum update -y
Add a docker
group
groupadd docker
Add users who use docker
to the group
useradd docker -g docker
Add current users to the group
sudo usermod -aG docker $USER
For systems above CentOS7, you can use curl -sSL https://get.docker.com/ | sh
to directly point to the installation script, here is to install with yum
.
sudo yum -y install docker-io
Execute docker version
to check whether the installation is successful:
Client version:1.7.1
Client API version:1.19
Go version(client): go1.4.2
Git commit(client): 786b29d/1.7.1
OS/Arch(client): linux/amd64
Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Docker Server has not been started yet, so there is a prompt at the end.
At present, there are several mature image acceleration in China. Here is an example of DockerCn
:
CentOS6 achieves image acceleration by editing the other_args
parameter of the /etc/sysconfig/docker
file.
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d
other_args="--registry-mirror=https://registry.docker-cn.com"
DOCKER_CERT_PATH=/etc/docker
# Resolves: rhbz#1176302(docker issue #407)
DOCKER_NOWARN_KERNEL_VERSION=1
# Location used for temporary files, such as those created by
# # docker load and build operations. Default is /var/lib/docker/tmp
# # Can be overriden by setting the following environment variable.
# # DOCKER_TMPDIR=/var/tmp
This example only applies to CentOS6
, if the service has already been started, the service service docker restart
needs to be restarted.
Docker China official image acceleration
Start the Docker service
service docker start
Attached to stop and restart the service
service docker stop
service docker restart
Execute docker version
Client version:1.7.1
Client API version:1.19
Go version(client): go1.4.2
Git commit(client): 786b29d/1.7.1
OS/Arch(client): linux/amd64
Server version:1.7.1
Server API version:1.19
Go version(server): go1.4.2
# /etc/sysconfig/docker
Git commit(server): 786b29d/1.7.1
OS/Arch(server): linux/amd64
Execute docker info
Containers:0
Images:0
Storage Driver: devicemapper
Pool Name: docker-202:2-1172437-pool
Pool Blocksize:65.54 kB
Backing Filesystem: extfs
Data file:/dev/loop0
Metadata file:/dev/loop1
Data Space Used:305.7 MB
Data Space Total:107.4 GB
Data Space Available:34.62 GB
Metadata Space Used:733.2 kB
Metadata Space Total:2.147 GB
Metadata Space Available:2.147 GB
Udev Sync Supported:true
Deferred Removal Enabled:false
Data loop file:/var/lib/docker/devicemapper/devicemapper/data
Metadata loop file:/var/lib/docker/devicemapper/devicemapper/metadata
Library Version:1.02.117-RHEL6(2016-12-13)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version:2.6.32-358.el6.x86_64
Operating System:<unknown>
CPUs:8
Total Memory:15.55 GiB
Name: ecs-634b-0002
ID: IMEI:V37Q:FO5S:3GYL:X2UH:2ECU:V4RW:---------------------------
At this point, the installation is complete!
Recommended Posts