安装Docker

 Docker的简介:
Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器或Windows 机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。
一个完整的Docker有以下几个部分组成:
DockerClient客户端
Docker Daemon守护进程
Docker Image镜像
DockerContainer容器

1.下载关于Docker的依赖环境

Xterm中输入以下代码安装依赖环境 回车

yum -y install yum-utils device-mapper-persistent-datalvm2

使用yum工具下载
yum是软件包管理工具
通过 执行 man yum
可以查看yum的帮助信息

2.设置下载Docker的镜像源

依赖环境下载完毕以后,设置下载的镜像源,如果不设置,会默认去Docker的官方下载,但是官方的服务器在国外,下载会比较缓慢,设置下载国内的镜像源(镜像就是英文单词image)
使用国内的阿里云

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
 

3.安装Docker

下面这个命令是将软件包信息提前在本地缓存一份,用来提高搜索安装软件的速度

 yum makecache fast

提高安装速度以后,安装docker相关的。(docker-ce 社区版 而ee是企业版)

yum install docker-ce docker-ce-cli containerd.io

4.1启动,并设置为开机自动启动,测试

systemctl start docker

4.2设置开机自动启动

systemctl enable docker

4.3 测试

docker run hello-world

如果出现以下代码,说明运行成功:

[root@w510-2-1~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe
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/

也可输入以下命令查看hello-world镜像是否下载成功:

docker images


荧光笔标记:

REPOSITORY 镜像的仓库源
TAG 镜像的标签
IMAGE ID 镜像的id
CREATED 镜像的创建时间
SIZE 镜像的大小

看到hello-world,这个镜像是存在的。

现在docker就安装完成了,能有时间的话不妨也去看看其他文章,动动你的小手指顺便点个赞呗!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值