docker 入门
2018-03-20 17:33
134 查看
一:在搭建好的虚拟机中配置好的Linux下安装:
注意:如果centos不是最新版,建议先更新到最新版后再来安装;
安装步骤:
使用yum安装
①:执行以下命令安装依赖包
测试Docker是否安装正确
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pulling fs layer
docker: error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/f2/f2a91732366c0332ccd7afd2a5c4ff2b9af81f549370f7a19acd460f87686bc7/data?Expires=1521641360&Signature=hldyqdMsLCFqvoEbCqB4Yfn67KvBD16Vt~Y7OBLGZavMql-foqxo1bsjc~eL81S5c3BJzWwSQLd8T1SPRyx00fjMFtm0tTds~Q68ccxIpbH6-OlkEPgdM5dk2uVbJLm8EzKv4Xq1Ti4nV113rwT~RL8U5MvLP4KG~mxnPZoeSvE_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout.
解决方案:
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
表明镜像拉去成功!
1:[root@localhost ~]# yum install -y docker
检出是否安装成功
2:[root@localhost ~]# docker -v
这时候发现和主机ping不通了(xshell也连不上)
报错:Job for network.service failed because the control process exited with error code.。。 错误
解决:
3: [root@localhost ~]# systemctl stop NetworkManager
: [root@localhost ~]# systemctl disable NetworkManager
然后:重启网卡: [root@localhost ~]# systemctl restart network [root@localhost ~]# ifcongfig
注意:如果centos不是最新版,建议先更新到最新版后再来安装;
安装步骤:
使用yum安装
①:执行以下命令安装依赖包
[root@localhost /]# yum install -y yum-utils \ device-mapper-persistent-data \ lvm2②:添加yum软件源(建议外网,)
[root@localhost /]#yum-config-manager \ --add-repo \ https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
安装Dockerce③:更新yum软件源缓存,并安装docker-ce
[root@localhost /]# yum makecache fast
[root@localhost /]# yum install docker-ce启动Docker CE
[root@localhost /]# systemctl enable docker
[root@localhost /]# systemctl start docker注意:在这里启动的时候回报错,一直启动 不起来,在网上找了很多方案试过后并不行,后来更新了以下censtos之后,发现可以了,在这里适合自己,优秀的你也可以试一试!
测试Docker是否安装正确
[root@localhost /]# docker run hello-world在这里会发现报错:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pulling fs layer
docker: error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/f2/f2a91732366c0332ccd7afd2a5c4ff2b9af81f549370f7a19acd460f87686bc7/data?Expires=1521641360&Signature=hldyqdMsLCFqvoEbCqB4Yfn67KvBD16Vt~Y7OBLGZavMql-foqxo1bsjc~eL81S5c3BJzWwSQLd8T1SPRyx00fjMFtm0tTds~Q68ccxIpbH6-OlkEPgdM5dk2uVbJLm8EzKv4Xq1Ti4nV113rwT~RL8U5MvLP4KG~mxnPZoeSvE_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout.
解决方案:
[root@localhost ~]# cd /etc/docker/ [root@localhost docker]# ls key.json (只有这个) [root@localhost docker]# vi daemon.json(添加的)
在daemon.json添加信息:配置镜像加速器:
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
[root@localhost /]# docker run hello-worldHello 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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
表明镜像拉去成功!
1:[root@localhost ~]# yum install -y docker
检出是否安装成功
2:[root@localhost ~]# docker -v
这时候发现和主机ping不通了(xshell也连不上)
报错:Job for network.service failed because the control process exited with error code.。。 错误
解决:
3: [root@localhost ~]# systemctl stop NetworkManager
: [root@localhost ~]# systemctl disable NetworkManager
然后:重启网卡: [root@localhost ~]# systemctl restart network [root@localhost ~]# ifcongfig
相关文章推荐
- Docker入门笔记_1_安装docker
- Docker入门系列(四):让你的服务跨越多台机器
- Docker 从入门到精通(一)基本操作
- Docker入门教程(四)Docker Registry
- Windows10下的docker安装与入门 (三) 创建自己的docker镜像并且在容器中运行它
- 在线培训 | Docker容器部署与管理入门
- Docker系列之——lxc虚拟化快速入门
- Docker+Jenkins入门教程
- Docker实践快速入门
- Docker 入门教程与实践
- 【docker入门】centos7下安装docker
- Docker 快速入门及试验环境配置
- docker 入门
- 沫沫大神的docker入门手册
- Docker学习笔记1:入门使用
- Docker简介与入门
- docker学习(二)docker入门
- Docker 从入门到放弃(一)