Docker Community Forums

Share and learn in the Docker community.

Accessing service on specific host port


#1

Hey guys quick question.

I have a service running on the host of the vagrant ubuntu VM on port 4200.

I then reverse SSH into the vagrant VM using the command ssh -- -R 4200:localhost:4200

From within the VM, I can curl -X GET localhost:4200 and get a response back.

Then I have docker set up in the vagrant Ubuntu VM.

I want to be able to access this service from the docker containers but without using host network mode.

I’ve figured that the Docker host IP is 172.17.0.1 and I can successfully Ping it and curl that ip with port mapped to other docker containers, but trying to curl -X GET 172.17.0.1:4200 from within the containers gives me the error curl: (7) Failed to connect to dockerhost port 4200: Connection refused.

How can I access this service from the container?