docker教程 安装docker
程序员文章站
2022-05-27 16:59:25
...
docker教程 安装
准备工作
1.centos系统
2.yum
开始安装
更新yum
[[email protected] ~]# yum update
中途会有一个或多个确认的提示,输入y(yes首字母)继续。
查找docker
待更新完毕之后,查看docker的列表
[[email protected] ~]# yum list docker
查询的结果如下:
[[email protected] ~]# yum list docker
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.jdcloud.com
* extras: mirrors.aliyun.com
* updates: mirror.jdcloud.com
可安装的软件包
docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos extras
安装docker
我们根据docker列表选择需要安装的软件包docker.x86_64进行安装
[[email protected] ~]# yum install docker.x86_64
安装结果如下:
已安装:
docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos
作为依赖被安装:
PyYAML.x86_64 0:3.10-11.el7 atomic-registries.x86_64 1:1.22.1-29.gitb507039.el7
container-selinux.noarch 2:2.107-3.el7 container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7
containers-common.x86_64 1:0.1.37-3.el7.centos docker-client.x86_64 2:1.13.1-103.git7f2769b.el7.centos
docker-common.x86_64 2:1.13.1-103.git7f2769b.el7.centos libyaml.x86_64 0:0.1.4-11.el7_0
oci-register-machine.x86_64 1:0-6.git2b44233.el7 oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6
oci-umount.x86_64 2:2.5-3.el7 python-pytoml.noarch 0:0.1.14-1.git7dea353.el7
subscription-manager-rhsm-certificates.x86_64 0:1.24.13-3.el7.centos
完毕!
启动docker
[[email protected] ~]# systemctl start docker
查看版本
[[email protected] ~]# docker version
[[email protected] ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
Go version: go1.10.3
Git commit: 7f2769b/1.13.1
Built: Sun Sep 15 14:06:47 2019
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
Go version: go1.10.3
Git commit: 7f2769b/1.13.1
Built: Sun Sep 15 14:06:47 2019
OS/Arch: linux/amd64
Experimental: false
测试是否可用
[[email protected] ~]# docker run hello-world:latest
[[email protected] ~]# docker run hello-world:latest
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
1b930d010525: Pull complete
Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for docker.io/hello-world:latest
Hello 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 the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share 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/