Here is the scenario:
I'm trying to run a multi-container job, in such a way that one container can communicate with other.
For a gitlab-runner using docker-executer, I'm able to achieve the functionality using alias.
But when I'm trying to use localhost, it throws error (which is obvious as the two containers are running on same vm has their own separate network namespaces)
But while running containers manually on local, we can forward the ports. can we do the same in GitLab CI pipeline (using the docker-executor)
stages:
- multi-container-job
communication-test:
stage: multi-container-job
image: curlimages/curl:latest
services:
- name: nginx:latest
# alias: web
script:
- echo "Waiting for nginx..."
- sleep 5
# - echo "Trying alias..."
# - curl http://web
- echo "Trying localhost..."
- curl http://localhost