docker仓库
docker hub
创建和使用私有仓库
这东西下载真的是下载成功的概率比买彩票中奖的概率还低,三天的不断重复下载,终于碰上一次成功的了
[root@mydocker ~]# docker run -e SEARCH_BACKEND=sqlalchemy -e SQLALCHEMY_INDEX_DATABASE=sqlite:////tmp/docker-registry.db -d --name registry -p 5000:5000 registry Unable to find image 'registry:latest' locally latest: Pulling from library/registry d6a5679aa3cf: Pull complete ad0eac849f8f: Pull complete 2261ba058a15: Pull complete f296fda86f10: Pull complete bcd4a541795b: Pull complete Digest: sha256:5a156ff125e5a12ac7fdec2b90b7e2ae5120fa249cf62248337b6d04abc574c8 Status: Downloaded newer image for registry:latest 08bc98e8adc213460547523d61555e132d36605e15684873b9aa6027581eef56 [root@mydocker ~]# [root@mydocker ~]# [root@mydocker ~]# [root@mydocker ~]# [root@mydocker ~]# [root@mydocker ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 08bc98e8adc2 registry "/entrypoint.sh /e..." 2 minutes ago Up 2 minutes 0.0.0.0:5000->5000/tcp registry [root@mydocker ~]#
报错了!!!!
解决办法是:
在/etc/docker下,创建daemon.json文件
{ "insecure-registries":["192.168.86.157:5000"]}
重启docker和重新启动registry:
[root@mydocker docker]# systemctl restart docker.service [root@mydocker docker]# docker run -d -p 5000:5000 -v /opt/ata/registry:/tmp/registry registry
[root@mydocker docker]# docker push 192.168.86.157:5000/dajiangtai/test2 The push refers to a repository [192.168.86.157:5000/dajiangtai/test2] 64d355965589: Pushed latest: digest: sha256:fd4c2e1f4142c4ae8940c58ada445e73f8f4d8fa462dd50c78b628751e170dd4 size: 528
看,成功解决了
[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/docker -H tcp://192.168.86.157:2375 -H unix:///var/run/docker.sock ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. MountFlags=slave LimitNOFILE=1048576 LimitNPROC=1048576 LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target
仓库加速服务
参考地址https://www.daocloud.io/mirror
[root@mydocker ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io docker version >= 1.12 {"registry-mirrors": ["http://f1361db2.m.daocloud.io"], "insecure-registries":["192.168.86.157:5000"]} Success. You need to restart docker to take effect: sudo systemctl restart docker [root@mydocker ~]# sudo systemctl restart docker [root@mydocker ~]# cat /etc/docker/daemon.json {"registry-mirrors": ["http://f1361db2.m.daocloud.io"], "insecure-registries":["192.168.86.157:5000"]} [root@mydocker ~]#
我们感觉比之前拉镜像过来的速度变快了
仓库管理
查看日志报错了