基于docker及traefik启用registry服务

创建registry数据卷

1
2
3
4
5
6
7
mkdir -p /data/registry

docker volume create --driver local \
--opt device=/data/registry \
--opt o=bind \
--opt type=none \
registry_data

运行registry服务

1
2
3
4
5
6
7
8
9
10
11
docker service create \
--name="registry" \
--mount type=volume,source=registry_data,destination=/var/lib/registry \
--network traefik-net \
--container-label traefik.backend="registry" \
--container-label traefik.frontend.entryPoints="http,https" \
--container-label traefik.frontend.rule="Host: registry.domain.com" \
--container-label traefik.port='5000' \
--container-label traefik.protocol='http' \
--replicas 1 \
registry:latest