shell> yum info docker
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
Name : docker
Arch : x86_64
Epoch :2
Version :1.13.1
Release :208.git7d71120.el7_9
Size :17 M
Repo : extras/7/x86_64
Summary : Automates deployment of containerized applications
URL : https://github.com/docker/docker
License : ASL 2.0
Description : Docker is an open-source engine that automates the deployment of any: application as a lightweight, portable, self-sufficient container that will: run virtually anywhere.:: Docker containers can encapsulate any payload, and will run consistently on: and between virtually any server. The same container that a developer builds: and tests on a laptop will run at scale, in production*, on VMs, bare-metal: servers, OpenStack clusters, public instances, or combinations of the above.
shell> docker version
Client:Version: 1.13.1API version: 1.26Package version:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
啟動docker
shell> systemctl start docker
查看docker運行狀態
shell> systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: active (running) since Wed 2021-11-17 16:44:59 CST; 20s agoDocs: http://docs.docker.comMain PID: 17532(dockerd-current)CGroup: /system.slice/docker.service├─17532 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-pr...└─17540 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-contai...Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.758139169+08:00"level=warning msg="Docker could not enable SELinux on the host system"
Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.804182251+08:00"level=info msg="Graph migration to content-addressability took 0.00 seconds"
Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.804653182+08:00"level=info msg="Loading containers: start."
Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.872826409+08:00"level=info msg="Firewalld running: false"
Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.957010199+08:00"level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be use...red IP address"
Nov 1716:44:58 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:58.987554477+08:00"level=info msg="Loading containers: done."
Nov 1716:44:59 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:59.031567584+08:00"level=info msg="Daemon has completed initialization"
Nov 1716:44:59 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:59.031591129+08:00"level=info msg="Docker daemon"commit="7d71120/1.13.1"graphdriver=overlay2 version=1.13.1
Nov 1716:44:59 VM-16-5-centos dockerd-current[17532]: time="2021-11-17T16:44:59.035053083+08:00"level=info msg="API listen on /var/run/docker.sock"
Nov 1716:44:59 VM-16-5-centos systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
docker 版的 Hello World!
shell> docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
2db29710123e: Pull complete
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
Status: Downloaded newer image for docker.io/hello-world:latestHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/