版本
极狐 GitLab v16.1.2-jh
步骤
如果使用 Let's Encrpt 集成,容器镜像仓库功能自动开启,访问地址为 your-gitlab-domain:5050。
否则,默认不开启,需要自己配置开启:
- 选择已有 Gitlab 域名或者另外一个域名,修改
/etc/gitlab/gitlab.rb - 把域名证书放在指定目录
- 重新配置 Gitlab 实例
参考:GitLab Container Registry administration
注意事项
- 容器镜像仓库需要走
HTTPS协议。因此,自定义域名需要自签证书 - 自定义域名需要绑
hosts才能以CLI方式访问容器镜像仓库
[root@localhost opt]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 gitlab.example.com
127.0.0.1 registry.gitlab.example.com
访问
Web UI
左侧菜单点击部署 -> 容器镜像库
CLI
[root@localhost opt]# docker login registry.gitlab.example.com
Username: your gitlab username
Password: your gitlab password
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@localhost opt]# docker logout registry.gitlab.example.com
Removing login credentials for registry.gitlab.example.com
浙公网安备 33010602011771号