I have a service running on my local machine on port 8500 - bound to 127.0.0.1:8500.
The machine is running Docker Engine - Community 20.10.20 on Ubuntu Linux 22.04.
On the local machine, I get the correct response if I do:
curl 127.0.0.1:8500
>> <a href="/ui/">Moved Permanently</a>.
I want to be able to forward this service to a Docker container running on the same machine, such that 127.0.0.1:8500 within the container produces the same result as above. The Docker container is provisioned using docker compose. I'm not able to use network_mode='host'
in this situation.
If I add to the docker-compose.yml file for the container:
ports:
- "172.17.0.1:8500:8500"
and run curl in the container, I get the following error:
curl: (7) Failed to connect to 127.0.0.1 port 8500: Connection refused
What am I doing wrong?