Run run.sh. Expected output:
test-a_1 | ok host
test-b_1 | ok host.docker.internal:host-gateway
test-c_1 | ok host.docker.internal
| version: "3.7" | |
| services: | |
| listen: | |
| build: . | |
| ports: | |
| - "8888:8888" | |
| command: bash -c "nc -vkl 8888" | |
| init: true | |
| test-a: | |
| build: . | |
| extra_hosts: | |
| - host:host-gateway | |
| environment: | |
| - ADDRESS=host | |
| test-b: | |
| build: . | |
| extra_hosts: | |
| - host.docker.internal:host-gateway | |
| environment: | |
| - ADDRESS=host.docker.internal | |
| test-c: | |
| build: . | |
| environment: | |
| - ADDRESS=host.docker.internal | |
| test-d: | |
| build: . | |
| environment: | |
| - ADDRESS=listen |
| FROM ubuntu | |
| RUN apt-get update | |
| RUN apt-get -y install netcat | |
| CMD nc -zv -w 1 $ADDRESS 8888 |
| docker-compose up -d listen; docker-compose up test-{a,b,c}; docker-compose down |