一、关闭firewall,永久关闭,使用iptables防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

yum install iptables-services -y    # 安装防火墙
systemctl restart iptables.service  # 重启防火墙

二、安装docker

要求centos7版本
yum install docker -y 安装 docker -v 查看版本   Docker version 1.12.6, build 3e8e77d/1.12.6
systemctl start docker   启动docker
ps -ef|grep docker     查看是否有docker进程
systemctl enable docker   设置docker开机自启动

三、下载打包好镜像文件

1)本地镜像制作过程

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                NAMES
da67831689e3        docker.io/nginx     "/bin/bash"         17 seconds ago      Up 16 seconds       0.0.0.0:80->80/tcp   cocky_aryabhata
[root@localhost ~]# 
[root@localhost ~]# docker commit da67831689e3 test
sha256:783e5f357a7fec72303b88fd4a6a97268ea3481fc2433331a23a59e4552ff1ed
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test                latest              783e5f357a7f        6 seconds ago       109 MB
docker.io/nginx     latest              7042885a156a        12 days ago         109 MB
[root@localhost ~]# 

[root@localhost ~]# docker save test > new_nginx.tar
[root@localhost ~]# ls
anaconda-ks.cfg  new_nginx.tar
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test                latest              783e5f357a7f        6 minutes ago       109 MB
docker.io/nginx     latest              7042885a156a        12 days ago         109 MB
[root@localhost ~]# cat new_nginx.tar |docker import - new-nginx
sha256:8e1deabb4ca699ac12196e09b2bd3742f6dc6eb2f5df5f64ee4487634d7ddf41
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
new-nginx           latest              8e1deabb4ca6        3 seconds ago       113 MB
test                latest              783e5f357a7f        7 minutes ago       109 MB
docker.io/nginx     latest              7042885a156a        12 days ago         109 MB

View Code