View kernel and operating system version
[ root@prod3 ~]# uname -r
3.10.0- 327. el7.x86_64
[ root@prod3 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511
1、 Install yum source
yum install -y epel-release
2、 yum install docker
yum install docker -y
3、 Start docker and set it to start on boot
systemctl start docker.service
systemctl enable docker.service
After installing docker, there will be an extra intranet ip segment (used by docker container)
[ root@prod3 ~]# ip addr
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:e6:44:58:df brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
4、 Find centos mirror
docker search centos
[ root@prod1 ~]# docker search centos
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/centos The official build of CentOS. 3184 [OK]
5、 Download mirror
docker search centos
[ root@prod3 ~]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
785 fe1d06b2d: Pull complete
Digest: sha256:be5b4a93f116a57ab3fd454ada72421eac892a3a4925627ac9a44f65fcd69cf8
6、 Check out the good mirror
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/centos latest 98d35105a391 28 hours ago 192.5 MB
7、 Run a container
docker run -it 98d35105a391 /bin/bash
Common commands
1、 docker info summary information
2、 docker images view image
3、 docker ps -a container status view
4、 docker pull centos (custom) download image
5、 docker search centos (custom) to find the mirror
6、 docker run starts the container
Case docker run --name some-nginx -p 80:80 -v /some/content:/usr/share/nginx/html -d nginx
Recommended Posts