【安装docker】使用云主机(centos7.6)安装和验证docker环境
版本要求:查看内核版本,需要大于3.10
[root@ecs-1021 ~]# uname -r
如果内核版本过低,需要更新内核:
[root@ecs-1021 ~]# yum update
Docker所需安装包所在网址
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
将rpm包直接下载到系统中
[root@ecs-1021 ~]# wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-18.09.7-3.el7.x86_64.rpm
安装docker(注意安装的顺序)
[root@ecs-1021 ~]# yum install -y containerd.io-1.2.6-3.3.el7.x86_64.rpm
[root@ecs-1021 ~]# yum -y install docker-ce-cli-18.09.7-3.el7.x86_64.rpm
[root@ecs-1021 ~]# yum -y install docker-ce-18.09.7-3.el7.x86_64.rpm
查看docker版本
[root@ecs-1021 ~]# docker --version
启动docker并设置开机启动
[root@ecs-1021 ~]# systemctl start docker
[root@ecs-1021 ~]# systemctl enable docker
测试
[root@ecs-1021 ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
Status: Downloaded newer image for 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/
- 点赞
- 收藏
- 关注作者
评论(0)