我在 Docker(Windows 10 Docker-Desktop)上运行了 GitLab 安装。我进行了 GitLab 容器注册表设置。当我尝试连接到容器注册表时,出现以下连接被拒绝错误;
No connection could be made because the target machine actively refused it.
你能帮忙解决这个问题吗?谢谢你。
我通过 PowerShell 运行的 Docker 登录命令;
docker login https://10.41.74.50:5005 -u root -p glpat-KUYeCWmUBJLCbKAdXEec
所有错误结果;
Error response from daemon: Get "https://10.41.74.50:5005/v2/": dialing 10.41.74.50:5005
with direct connection: connecting to 10.41.74.50:5005: dial tcp 10.41.74.50:5005:
connectex: No connection could be made because the target machine actively refused it.
gitlab.rb里面GitLab的环境设置如下;
## GitLab URL
external_url 'https://10.41.74.50'
################################################################################
## Container Registry settings
##! Docs: https://docs.gitlab.com/ee/administration/packages/container_registry.html
################################################################################
registry_external_url 'https://10.41.74.50:5005'
### Settings used by GitLab application
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "10.41.74.50"
gitlab_rails['registry_port'] = "5005"
### Settings used by Registry application
registry['enable'] = true
################################################################################
## GitLab NGINX
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html
################################################################################
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/10.41.74.50.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/10.41.74.50.key"
################################################################################
# Let's Encrypt integration
################################################################################
letsencrypt['enable'] = false
docker-compose.yml;
version: '3.7'
services:
gitlab:
image: gitlab/gitlab-ce:latest
restart: always
hostname: '10.41.74.50'
container_name: gitlab-latest-test
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- D:/T_gitlab_volume/etc/gitlab:/etc/gitlab
- D:/T_gitlab_volume/var/log/gitlab:/var/log/gitlab
- D:/T_gitlab_volume/var/opt/gitlab:/var/opt/gitlab
- D:/T_gitlab_volume/var/opt/gitlab/backups:/var/opt/gitlab/backups
Docker环境;
Docker version 24.0.2, build cb74dfc
Docker Compose version v2.19.1
Docker-Desktop version 4.22.1
GitLab 容器注册表网页;
我刚刚错过了将 5005 端口添加到 docker-compose.yml 中。我在重新检查帖子时注意到这一点。
docker-compose.yml;
version: '3.7'
services:
gitlab:
image: gitlab/gitlab-ce:latest
restart: always
hostname: '10.41.74.50'
container_name: gitlab-latest-test
ports:
- '80:80'
- '443:443'
- '22:22'
- '5005:5005'
volumes:
- D:/T_gitlab_volume/etc/gitlab:/etc/gitlab
- D:/T_gitlab_volume/var/log/gitlab:/var/log/gitlab
- D:/T_gitlab_volume/var/opt/gitlab:/var/opt/gitlab
- D:/T_gitlab_volume/var/opt/gitlab/backups:/var/opt/gitlab/backups