docker方式启动镜像仓库

/ # cat /etc/docker/registry/config.yml
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold:
/ # [root@localhost ~]# docker run -it --rm --name jj registry: /bin/sh

配置 TLS 证书

当本地主机运行 Registry 服务后,所有能访问到该主机的 Docker Host 都可以把它作为 私有仓库使用,只需要在镜像名称前面添加上具体的服务器地址即可。 例如将本地的nginx 推入自己的仓库

私有仓库需要启用 TLS 认证,否则会报错。 在第一部分中,我们介绍了通过添加 DOCKER_ OPTS="--insecure-registry  yourhostname:5000"  (此版本下的docker没有这个硬性要求)

[root@localhost ~]# docker version
Client:
Version: 18.09.
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false

推拉镜像

docker images
docker tag nginx:alpine localhost:/nginx/alpine
docker push localhost:/nginx/alpine
04-22 10:21
查看更多