docker 本地yum源安装

1、准备docker软件包
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

$ sudo yum-config-manager --enable docker-ce-edge

$ yum install --downloadonly --downloaddir=/home/work/repo/docker-ce docker-ce

2、配置yum源
$ yum install createrepo
$ createrepo -d /home/work/repo/docker-ce/

3、配置nginx
$ cat /usr/local/nginx/conf/vhost/server/package.conf

server {
    listen          80;
    server_name     yum.serve;
    server_name     public.serve;
    server_name     package.wcj.me;
    access_log      /usr/local/nginx/logs/share.access.log ;
    error_log       /usr/local/nginx/logs/share.error.log;

    location / {
            root                    /home/work;
                autoindex               on;
                autoindex_exact_size    on;
                autoindex_localtime     on;
        }
}

$ nginx -t
$ nginx -s reload

4、客户端配置(添加)
$ vim /etc/yum.repos.d/CentOS-Base.repo

   [docker-ce]
   name=18.06.1.ce-3.el7
   baseurl=http://yum.serve/repo/docker-ce
   enabled=1
   priority=99
   gpgcheck=0

$ $ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
$ sudo yum install -y device-mapper-persistent-data lvm2
$ yum install docker-ce

转载于:https://blog.51cto.com/11578535/2178129

你可能感兴趣的:(docker 本地yum源安装)