Unable to access service from private registry
Long story short: looks like there is no way to address services in private registries on same domain as gitlab (on another port).
I am using gitlab-ci with docker runner I want to use image from our gitlab registry (located, e.g. on gitlab.example.com:4567) to start as a service (postgres with test data preinstalled) with my build:
stage: test
services:
- gitlab.example.com:4567/docker/db-fixture
script:
- export DB_CONNECT_STRING="user=test dbname=test password=test host=docker__db-fixture port=5432 sslmode=disable"
- cd ./integration
- make test
But according to http://docs.gitlab.com/ce/ci/docker/using_docker_images.html
The alias hostname for the service is made from the image name following these rules:
Everything after : is stripped
Slash (/) is replaced with double underscores (__)
hostname for the service will be "gitlab.example.com" because there is colon for port specification (gitlab.example.com:4567/docker/db-fixture). Now I have a dilemma: I can either use hostname gitlab.example.com as my service, but then build fails to fetch changes:
Fetching changes...
Removing gopath/
Removing linter.log
HEAD is now at 27aa2f0 db image build only for sql* tags and branches
fatal: unable to access 'https://gitlab-ci-token:xxxxxx@gitlab.example.com/group/integration.git/': Failed to connect to gitlab.example.com port 443: Connection refused
or as a hostname of my gitlab server with git repository that I need to clone.
If i add
extra_hosts = ["gitlab.example.com:125.123.21.63"]
in config.toml - I can clone, but I do not have access to my postgres service in my build anymore.
I think "Everything after : is stripped" rule should not be applied to registry port, or there needs to be a way to specify service hostname explicitly e.g.:
services:
- gitlab.example.com:4567/docker/db-fixture as "db-fixture"