redhat 7.2 内网安装docker

本文介绍在内网环境下如果通过网络代理映射来完成docekr的安装,首先在能上网的windows机器上安装squid,并启动,本实例中windows机器IP为 192.168.192.101 ,squid服务端口为3130(默认3128)

1、登录进入redhat 7.2

2、依次执行如下语句

 1 proxy=192.168.192.101:3130
 2 echo "proxy=http://${proxy}" >>/etc/yum.conf
 3 echo "http_proxy=${proxy}" >>/etc/profile
 4 echo "export http_proxy" >>/etc/profile
 5 source /etc/profile  #设置完成之后就能上网
 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 7 sed -i  's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
 8 yum clean all
 9 yum list
10 yum -y install docker
11 groupadd docker
12 useradd -d /home/docker -m -g docker docker
13 # passwd #设置密码 
14 systemctl daemon-reexec 
15 systemctl start docker
16 #如果启动这一步出错 vi /etc/sysconfig/docker OPTIONS='--selinux-enabled=false 设置成false
17 
18 #设置docker代理,使得其可以获取到镜像
19 mkdir -p /etc/systemd/system/docker.service.d
20 echo "[Service]">/etc/systemd/system/docker.service.d/http-proxy.conf
21 echo "Environment=\"HTTP_PROXY=http://${proxy}/\" \"HTTPS_PROXY=https://${proxy}/\"" >>/etc/systemd/system/docker.service.d/http-proxy.conf
22 systemctl daemon-reload
23 systemctl restart docker

 

至此docker则安装完成。

posted @ 2018-05-29 19:36  今夜通宵  阅读(556)  评论(0编辑  收藏  举报