Docker Community Forums

Share and learn in the Docker community.

Timeout when access other docker services within a docker container

(Zhangle) #1

I have 2 docker containers running on my host, web1 and web2. Container web1 maps port 8080 to the host port 18080, and web2 maps port 8080 to the host port 28080. The IP address of the host is (yes it’s LAN). I can access and from other machines in the same LAN.

When I tried to access (curl or from within web1/web2 container, I got a timeout error.

However, the Apache server running on port 8080 of the host can be accessed by from within web1/web2 container, which means the route from container to host is clear.

So my question is: Why the timeout error happens and how to access from docker container?

This is the docker-compose file I used to start up web2:

version: '2' 
        build: .
          - "28080:8080"
          - "8080"
          - TALENTS_AUTH_HOST=
          - TALENTS_AUTH_PORT=18080
          - TALENTS_ANALYSIS_PORT=18082

(Gr8h8m) #2

Try adding --net=host to docker run …for more ou can check … helped me a lot when working on essay autowriter app
Good luck