1 rpm upload files, unzip
yum file:
链接:https://pan.baidu.com/s/1_tSwm2jqXqrV2mbMk0C80g
提取码:5gd7
[root@k8smaster01 zhaiky]# unzip yum.zip
Archive: yum.zip
creating: yum/
inflating: yum/docker-1.13.1-103.git7f2769b.el7.centos.x86_64.rpm
inflating: yum/docker-client-1.13.1-103.git7f2769b.el7.centos.x86_64.rpm
inflating: yum/docker-common-1.13.1-103.git7f2769b.el7.centos.x86_64.rpm
inflating: yum/elinks-0.12-0.37.pre6.el7.0.1.x86_64.rpm
inflating: yum/etcd-3.3.11-2.el7.centos.x86_64.rpm
inflating: yum/flannel-0.7.1-4.el7.x86_64.rpm
inflating: yum/gpm-libs-1.20.7-6.el7.x86_64.rpm
inflating: yum/httpd-2.4.6-90.el7.centos.x86_64.rpm
inflating: yum/httpd-tools-2.4.6-90.el7.centos.x86_64.rpm
inflating: yum/js-1.8.5-20.el7.x86_64.rpm
inflating: yum/kernel-lt-4.4.207-1.el7.elrepo.x86_64.rpm
inflating: yum/kubernetes-client-1.5.2-0.7.git269f928.el7.x86_64.rpm
inflating: yum/kubernetes-master-1.5.2-0.7.git269f928.el7.x86_64.rpm
inflating: yum/lrzsz-0.12.20-36.el7.x86_64.rpm
inflating: yum/nss_compat_ossl-0.9.6-8.el7.x86_64.rpm
inflating: yum/ntp-4.2.6p5-29.el7.centos.x86_64.rpm
inflating: yum/ntpdate-4.2.6p5-29.el7.centos.x86_64.rpm
inflating: yum/unzip-6.0-20.el7.x86_64.rpm
inflating: yum/vsftpd-3.0.2-25.el7.x86_64.rpm
inflating: yum/createrepo-0.9.9-28.el7.noarch.rpm
creating: yum/repodata/
inflating: yum/repodata/f3ce581fcc0df911a991bb4de0ec69734d34e709163755cc73f2b33294ae3fc8-other.sqlite.bz2
inflating: yum/repodata/e7c0b54bf7034761afe8273df137b5fd02cb1ccd12c82a13d98b8f3dfb9ec097-other.xml.gz
inflating: yum/repodata/6ea25bac3dbbf238dbe019e0d8194d14e263b47bd569257552600e14b0703946-filelists.sqlite.bz2
inflating: yum/repodata/580edaa5e2bcf2ea8112c50fcb418be547462664f6a0f9d6ffcc9b5b032a2994-filelists.xml.gz
inflating: yum/repodata/1ce6e205b25bbcc793f0a114f2adab54498d1b1a7b480228845fc712b5dfec38-primary.sqlite.bz2
inflating: yum/repodata/654b6a5366bfd98b0669eb1ffe6faf41afb6ac26a8634da0a7d7963649e03b8c-primary.xml.gz
inflating: yum/repodata/repomd.xml
[root@k8smaster01 zhaiky]#
2, to configure the local source yum
2.1, http service installation, the folder to yum, and set permissions
[k8smaster01 the root @ ~] # CP -R & lt / Home / zhaiky / yum / var / WWW / HTML /
[the root HTML @ k8smaster01 ] # the chmod -R & lt yum 777 /
2.2, yum.repo configuration file
[@ k8snode01 the root etc] More yum.repo #
[yum]
name = Base
BaseURL = HTTP: //192.168.23.134/yum
gpgcheck = 0
[the root @ k8smaster01 yum.repos.d] # yum Clean All
Loaded plugins: fastestmirror
Cleaning Repos: Base ELRepo the Updates Extras yum
[root @ k8smaster01 yum.repos.d] #
3、docker私有仓库的搭建,安装docker
[root@k8smaster01 ~]# yum install docker -y
Loaded plugins: fastestmirror
Determining fastest mirrors
yum | 2.9 kB 00:00:00
yum/primary_db | 454 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================
Installing:
docker x86_64 2:1.13.1-103.git7f2769b.el7.centos yum 18 M
Transaction Summary
============================================================================================================================================================================
Install 1 Package
Total download size: 18 M
Installed size: 65 M
Downloading packages:
docker-1.13.1-103.git7f2769b.el7.centos.x86_64.rpm | 18 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:docker-1.13.1-103.git7f2769b.el7.centos.x86_64 1/1
Verifying : 2:docker-1.13.1-103.git7f2769b.el7.centos.x86_64 1/1
Installed:
docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos
Complete!
[root@k8smaster01 ~]#
4, and upload registry_v2.tar introduced mirror nginx.tar
Mirror package:
链接:https://pan.baidu.com/s/1T4snL6ntNqCtxkF4eiUPcA
提取码:jpfe
[root@k8smaster01 zhaiky]# docker load -i registry_v2.tar
Loaded image: docker.io/registry:latest
[root@k8smaster01 zhaiky]# docker load -i nginx.tar
Loaded image: 192.168.23.134:5000/nginx:latest
[root@k8smaster01 zhaiky]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.23.134:5000/nginx latest c7460dfcab50 5 days ago 126 MB
docker.io/registry latest f32a97de94e1 10 months ago 25.8 MB
[root@k8smaster01 zhaiky]#
5, start warehouse
[@ k8smaster01 the root Registry] # Docker -d -p 5000 RUN: 5000 --restart --name = Always-Private-Docker to true Registry --privileged = -v / Data / Registry: / var / lib / Registry Registry
76d008081e427438a2efed0b1f579711025b8c27265472296f3b89d1037d0c60
[@ k8smaster01 the root Registry] PS # Docker
CONTAINER ID PORTS the STATUS the IMAGE CREATED the COMMAND NAMES
76d008081e42 Registry "/entrypoint.sh / E ..." 10 seconds The Private ago Member Up. 9 seconds The 0.0.0.0:5000->5000/tcp Registry--docker
[root @ k8smaster01 Registry] #
Description: -d represents a container in the background. -p 5000: 5000 represents 5000 to 5000 container port mapping port virtual machines. -Restart = always represents a container with the docker activated to start, while if the abnormal termination of the container, is automatically started; found that the use of docker STOP command to stop the container,
This parameter does not allow the container to automatically restart. -Name private-docker-registry setting container name. -Privileged = true real container with root privileges within the container. -v / data / registry: / var / lib / registry in the container / var / lib / registry directory mapped
to a virtual machine / data / registry; / var / lib / registry is mirrored private directory container storage depot.
6、nginx推送到私有仓库
[root@k8smaster01 registry]# docker push 192.168.23.134:5000/nginx:latest
The push refers to a repository [192.168.23.134:5000/nginx]
Get https://192.168.23.134:5000/v1/_ping: http: server gave HTTP response to HTTPS client
[root@k8smaster01 registry]#
报错解决:
修改/usr/lib/systemd/system/docker.service配置
[root@k8smaster01 registry]# more /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
Requires=docker-cleanup.timer
[Service]
Type=notify
NotifyAccess=main
EnvironmentFile=-/run/containers/registries.conf
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd-current \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--insecure-registry 0.0.0.0/0 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
--init-path=/usr/libexec/docker/docker-init-current \
--seccomp-profile=/etc/docker/seccomp.json \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
$REGISTRIES
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
KillMode=process
[Install]
WantedBy=multi-user.target
[root@k8smaster01 registry]# systemctl daemon-reload && systemctl restart docker
[root@k8smaster01 registry]# docker push 192.168.23.134:5000/nginx:latest
The push refers to a repository [192.168.23.134:5000/nginx]
c26e88311e71: Pushed
17fde96446df: Pushed
556c5fb0d91b: Pushed
latest: digest: sha256:89a42c3ba15f09a3fbe39856bddacdf9e94cd03df7403cad4fc105088e268fc9 size: 948
[root@k8smaster01 registry]#
7, the warehouse view mirror
[@ k8smaster01 the root Registry] # curl "http://192.168.23.134:5000/v2/_catalog"
{ "Repositories": [ "Nginx"]}
8、从私有仓库pull镜像
[root@k8smaster01 registry]# docker rmi -f 192.168.23.134:5000/nginx
Untagged: 192.168.23.134:5000/nginx:latest
Untagged: 192.168.23.134:5000/nginx@sha256:89a42c3ba15f09a3fbe39856bddacdf9e94cd03df7403cad4fc105088e268fc9
Deleted: sha256:c7460dfcab502275e9c842588df406444069c00a48d9a995619c243079a4c2f7
Deleted: sha256:3e51598e49c550f8b212a07c6ff2ed47a09eeb637f67d1b3c5468e9a8ee646e3
Deleted: sha256:a8b9a5643b3cc8082997d3d2fbaf4b53213ff80aa4169226be8b3768ae6e3605
Deleted: sha256:556c5fb0d91b726083a8ce42e2faaed99f11bc68d3f70e2c7bbce87e7e0b3e10
[root@k8smaster01 registry]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/registry latest f32a97de94e1 10 months ago 25.8 MB
[root@k8smaster01 registry]# docker pull 192.168.23.134:5000/nginx
Using default tag: latest
Trying to pull repository 192.168.23.134:5000/nginx ...
latest: Pulling from 192.168.23.134:5000/nginx
8ec398bc0356: Pull complete
dfb2a46f8c2c: Pull complete
b65031b6a2a5: Pull complete
Digest: sha256:89a42c3ba15f09a3fbe39856bddacdf9e94cd03df7403cad4fc105088e268fc9
Status: Downloaded newer image for 192.168.23.134:5000/nginx:latest
[root@k8smaster01 registry]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.23.134:5000/nginx latest c7460dfcab50 5 days ago 126 MB
docker.io/registry latest f32a97de94e1 10 months ago 25.8 MB
[root@k8smaster01 registry]#