@sameersbn @panosoft @mikew
hi, first of all to thank you for this community and for the contribution you make to the informatics.
My problem is this, I'm working with docker-gitlab sameersbn: 8.16.6, postgresql:9.6-2, redis:latest, registry:2.5, nginx. All working properly as far as I could see but I have configured gitlab-runner:latest for continuous integration and I got the following error when registering a runner for gitlab: _"ERROR: Registering runner... failed runner=xrz3LPZ_ status=couldn't execute POST against https://localhost:10443/ci/api/v1/runners/register.json: Post https://localhost:10443/ci/api/v1/runners/register.json: dial tcp [::1]:10443: getsockopt: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems "_.
I do not know if something in my configuration is wrong or something is missing to configure for this to work, please I need help this is very important for the project.
Then I describe my working environment together with my configuration file docker-compose.yml.
Docker version 17.03.0-ce, build 60ccb22
docker-compose version 1.11.2, build dfed245
```
version: '2'
networks:
lb_web:
external: true
back:
driver: bridge
services:
redis:
restart: always
image: sameersbn/redis:latest
container_name: redis
command:
- --loglevel warning
volumes:
- /srv/docker/gitlab/redis:/var/lib/redis:Z
networks:
- back
postgresql:
restart: always
image: sameersbn/postgresql:9.6-2
container_name: postgresql
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql:Z
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- DB_EXTENSION=pg_trgm
networks:
- back
gitlab:
restart: always
image: sameersbn/gitlab:8.16.6
container_name: gitlab
depends_on:
- redis
- postgresql
external_links:
- registry:registry.localhost
expose:
- "80"
ports:
- "10022:22"
- "10443:443"
- "5005:5005"
volumes:
- /srv/docker/gitlab/gitlab:/home/git/data:Z
- /srv/docker/gitlab/gitlab/certs:/home/git/data/certs
- /srv/docker/gitlab/logs:/var/log/gitlab
- /var/run/docker.sock:/var/run/docker.sock
hostname: localhost
environment:
- DEBUG=false
- DB_ADAPTER=postgresql
- DB_HOST=postgresql
- DB_PORT=5432
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ=America/Los_Angeles
- GITLAB_TIMEZONE=America/Los_Angeles
- GITLAB_HTTPS=true
- SSL_SELF_SIGNED=true
- GITLAB_HOST=localhost
- GITLAB_PORT=10443
- GITLAB_SSH_PORT=10022
- GITLAB_RELATIVE_URL_ROOT=
- GITLAB_SECRETS_DB_KEY_BASE=xxxxxxxx
- GITLAB_SECRETS_SECRET_KEY_BASE=xxxxxxx
- GITLAB_SECRETS_OTP_KEY_BASE=xxxxxx
- GITLAB_ROOT_PASSWORD=xxxxx
- [email protected]
- GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
- GITLAB_NOTIFY_PUSHER=true
- [email protected]
- [email protected]
- [email protected]
- GITLAB_BACKUP_SCHEDULE=daily
- GITLAB_BACKUP_TIME=01:00
- SMTP_ENABLED=true
- SMTP_DOMAIN=www.gmail.com
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- [email protected]
- SMTP_PASS=password
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=login
- IMAP_ENABLED=true
- IMAP_HOST=imap.gmail.com
- IMAP_PORT=993
- [email protected]
- IMAP_PASS=password
- IMAP_SSL=true
- IMAP_STARTTLS=
- VIRTUAL_HOST=localhost
- SSL_CERTIFICATE_PATH=/home/git/data/certs/gitlab.crt
- SSL_KEY_PATH =/home/git/data/certs/gitlab.key
- SSL_CA_CERTIFICATES_PATH=/home/git/data/certs/gitlab.crt
- SSL_DHPARAM_PATH=/home/git/data/certs/dhparam.pem
- GITLAB_REPOS_DIR=/home/git/data/repositories
- GITLAB_BACKUP_DIR=/home/git/data/backups
- GITLAB_SHARED_DIR=/home/git/data/shared
- GITLAB_BUILDS_DIR=/home/git/data/builds
- GITLAB_ARTIFACTS_DIR=/home/git/data/shared/artifacts
- GITLAB_PROJECTS_CONTAINER_REGISTRY=true
- GITLAB_REGISTRY_DIR=/home/git/data/shared/registry
- GITLAB_REGISTRY_ENABLED=true
- GITLAB_REGISTRY_HOST=registry.localhost
- GITLAB_REGISTRY_PORT=5005
- GITLAB_REGISTRY_API_URL=http://registry.localhost:5000
- GITLAB_REGISTRY_CERT_PATH=/home/git/data/certs/registry.crt
- GITLAB_REGISTRY_KEY_PATH=/home/git/data/certs/registry.key
- GITLAB_REGISTRY_ISSUER=gitlab-issuer
- SSL_REGISTRY_KEY_PATH=/home/git/data/certs/registry.key
- SSL_REGISTRY_CERT_PATH=/home/git/data/certs/registry.crt
networks:
- back
- lb_web
registry:
restart: always
image: registry:2.5
container_name: registry
volumes:
- /srv/docker/registry:/registry
- /srv/docker/gitlab/gitlab/certs:/home/git/data/certs
ports:
- "5000:5000"
external_links:
- "gitlab:localhost"
environment:
- REGISTRY_LOG_LEVEL=info
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/registry
- REGISTRY_AUTH_TOKEN_REALM=https://localhost:10443/jwt/auth
- REGISTRY_AUTH_TOKEN_SERVICE=container_registry
- REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer
- REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/home/git/data/certs/registry.crt
- REGISTRY_STORAGE_DELETE_ENABLED=true
- REGISTRY_HTTP_SECRET=xxxxxx
networks:
- back
nginx:
restart: always
image: nginx
container_name: nginx
links:
- registry
volumes:
- /srv/docker/nginx/nginx.conf:/etc/nginx/nginx.conf
environment:
- VIRTUAL_HOST=registry.localhost
- REGISTRY_HTTP_RELATIVEURLS=true
networks:
- back
- lb_web
gitlab-runner:
restart: always
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner
volumes:
- /srv/gitlab-runner/config:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
- /srv/docker/gitlab/gitlab/certs:/etc/gitlab-runner/certs
environment:
- CA_CERTIFICATES_PATH=/home/git/data/certs/gitlab.crt
networks:
- back
```
Thanks in advance, any help and comment is welcome.
Hey,
your problem is that you use localhost. Every container has is own interface and an own interface for localhostYou should use the container name instead of localhost this should work than.
In your case gitlab
@solidnerd thanks for respond me. Let me see if I understood, I have to rename GITLAB_HOST = localhost for another name?? Which variable in specific do I have to modify?... thanks solidnerd for your help and excuse my English. Stay tuned to your comments.
Gracias :)
@solidnerd I am sorry my friend, Even throw me do not understand that in specific of my docker-compose.yml I have to modify ... please help my friend.
No, you should use gitlab as hostname when registring the runner.
$ gitlab-runner register --name my-runner --url http://gitlab --registration-token
Notes:
<my-registration-token> by the token visible in GitLabgitlab-runner container :wink:In my case it has been in fact the solution to pass the value being attached to container_name for successfully registering my gitlab-runner , so thanks for that.
Although there's one strange behavior which bugs me a bit:
In my docker-compose.yml I'm providing a hostname: gitlab-custom which is - as expected - being passed to the containers /etc/hosts file.
But when accessing the Web-GUI of GitLab I have to access it by using the hostname of my local host. I would expect to be able to access GitlLab UI by passing the hostname as provided in docker-compose.yml (which is gitlab-custom).
The GITLAB_OMNIBUS_CONFIG for the external URL is set to external_url 'https://gitlab-custom.de'
When navigating to the Admin Area/Runners section of the Web-GUI, the section "How to setup a shared Runner for a new project" in order to retrieve the registration token, step 2 is again specifying a URL with the hostname of my actual host-machine, e. g. "https://localhostname/
But registering the runner is only possible with passing the container name as stated above.
Thanks in advance
@FranVeraC Does your probem still exists or can we close this issue ?
I am still having this issue
@herobix Same issue. It may be caused by gitlab is behind a reverse proxy like nginx.
This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.
Most helpful comment
Hey,
your problem is that you use localhost. Every container has is own interface and an own interface for
localhostYou should use the container name instead of localhost this should work than.In your case
gitlab