Reputation: 1334
How can I access the nginx service in the script section of a Gitlab-CI job?
run_tests:
image: curlimages/curl
stage: test
services:
- name: bitnami/nginx
script:
- curl http://127.0.0.1:8080
At the moment I always get the error:
curl: (7) Failed to connect to 127.0.0.1 port 8080 after 4 ms: Connection refused
According to the bitnami nginx documentation, the container should display the standard page on port 8080.
Upvotes: 0
Views: 538
Reputation: 4622
In your case correct service hostname would be bitnami-nginx
and yaml
run_tests:
image: curlimages/curl
stage: test
services:
- name: bitnami/nginx
script:
- curl http://bitnami-nginx:8080
As per https://docs.gitlab.com/ee/ci/services/#accessing-the-services
The default aliases for the service’s hostname are created from its image name following these rules:
Upvotes: 1