Docker(一):安装

Docker中文官方网站

Docker镜像仓库

CentOS Docker安装条件

Docker支持以下的CentOS版本
  • CentOS 7 (64-bit) 系统内核版本3.10以上
  • CentOS 6.5 (64-bit)或更高版本 系统内核版本2.6.32-431或更高版本
## 查看内核版本
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64

## 查看已安装的CentOS的版本
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

此处已centOS 7为例(初次安装,权限为root)

根据英文官方文档进行安装docker
中文官方文档

$ yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
$ yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
$ yum-config-manager --enable docker-ce-edge
$ yum-config-manager --enable docker-ce-test
$ yum-config-manager --disable docker-ce-edge
$ yum install docker-ce
至此,docker安装完毕
启动docker
$ systemctl start docker
随服务器启动
systemctl enable docker

设置docker镜像加速器
本例使用阿里云仓库
进入管理中心,使用淘宝账号登录

进入管理中心

点击“镜像加速器”,可以看到右边有个“加速器地址”

在这里插入图片描述

1. 安装/升级Docker客户端
推荐安装1.10.0以上版本的Docker客户端,参考文档 docker-ce

2. 配置镜像加速器
针对Docker客户端版本大于 1.10.0 的用户

您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
vim /etc/docker/daemon.json
## 将下面的json写入
{
  "registry-mirrors": ["https://********.mirror.aliyuncs.com"]
}
## 保存后重启
systemctl daemon-reload
systemctl restart docker
测试hello world
# docker run hello-world
Unable to find image 'hello-world:latest' locally ## 显示本地没有该镜像,会从仓库拉取,并运行
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete 
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
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/

run流程图

在这里插入图片描述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值