博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在 centos7.2安装docker 并设置阿里云源
阅读量:2156 次
发布时间:2019-05-01

本文共 2521 字,大约阅读时间需要 8 分钟。

现在docker 在原来的基础上分为两个分支版本: Docker CE 和 Docker EE。Docker CE 即社区免费版,Docker EE 即企业版,需付费使用。个人使用Docker CE 好了

删除系统就的docker组件

[root@host01 ~]# yum remove -y docker \docker-client docker-client-latest \docker-common docker-latest \docker-latest-logrotate \docker-logrotate docker-selinux \docker-engine-selinux docker-engine已加载插件:fastestmirror参数 docker 没有匹配参数 docker-client 没有匹配参数 docker-client-latest 没有匹配参数 docker-common 没有匹配参数 docker-latest 没有匹配参数 docker-latest-logrotate 没有匹配参数 docker-logrotate 没有匹配参数 docker-selinux 没有匹配参数 docker-engine-selinux 没有匹配参数 docker-engine 没有匹配不删除任何软件包[root@host01 ~]#

安装一些依赖

[root@host01 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

添加docker的源

[root@host01 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo已加载插件:fastestmirroradding repo from: https://download.docker.com/linux/centos/docker-ce.repograbbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.reporepo saved to /etc/yum.repos.d/docker-ce.repo[root@host01 ~]#

安装docker-ce

[root@host01 ~]# yum install -y docker-ce

启动docker

[root@host01 ~]# systemctl start docker

验证docker

[root@host01 ~]# docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world1b930d010525: Pull complete Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4eStatus: Downloaded newer image for 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 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 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/[root@host01 ~]#

配置阿里云的源

1、要先注册一个阿里云的账号然后登陆到阿里云的【容器镜像服务】页面,地址:

2、在下面截图处找到加速器地址将加速地址复制下载
3、复制阿里云上提供的直接命令直接运行即可

sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker

转载地址:http://uulwb.baihongyu.com/

你可能感兴趣的文章
Windows7中IIS简单安装与配置(详细图解)
查看>>
linux基本命令
查看>>
BlockQueue 生产消费 不需要判断阻塞唤醒条件
查看>>
强引用 软引用 弱引用 虚引用
查看>>
数据类型 java转换
查看>>
"NetworkError: 400 Bad Request - http://172.16.47.117:8088/rhip/**/####t/approval?date=976
查看>>
mybatis 根据 数据库表 自动生成 实体
查看>>
win10将IE11兼容ie10
查看>>
checkbox设置字体颜色
查看>>
第一篇 HelloWorld.java重新学起
查看>>
ORACLE表空间扩张
查看>>
orcal 循环执行sql
查看>>
web.xml配置监听器,加载数据库信息配置文件ServletContextListener
查看>>
结构型模式之桥接模式(Bridge)
查看>>
行为型模式之状态模式(State)
查看>>
行为型模式之策略模式(Strategy)
查看>>
行为型模式之模板方法模式(TemplateMethod)
查看>>
行为型模式之访问者模式(Visitor)
查看>>
大小端详解
查看>>
source insight使用方法简介
查看>>