docker容器安装部署

docker容器安装部署

docker容器安装部署

1.下载docker-ce-selinux、docker-ce的rpm包

https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm

2.将上述两个rpm包上传到linux系统/docker目录下

3.进入/docker目录

cd /docker/

4.安装docker

yum -y install *

5.开启docker服务

systemctl start docker
systemctl enable docker

6.测试docker是否正常开启

docker run hello-world

6.1报错

a.报以下错误

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: TLS handshaketimeout

解决方法:
通过dig @114.114.114.114 registry-1.docker.io找到可用IP地址

#若上述命令报以下错误
-bash: dig: command not found
#安装bind-utils
yum -y intall bind-utils
#dig命令语句运行成功,找到以下信息
;; ANSWER SECTION:
registry-1.docker.io.	600	IN	A	3.210.179.11
#在本地hosts添加以下信息
vim /etc/hosts
3.210.179.11 registry-1.docker.io

b.报以下错误

error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/

解决办法:

systemctl stop docker

echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f2d6cb40.m.daocloud.io\"" | sudo tee -a /etc/default/docker

systemctl start docker

7.成功标志
信息字段内含有Hello from Docker!,即表示成功。

[root@docker docker]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值