moby: Unable to access local server running on docker

I am trying to setting up heroku java app locally using docker. Both container running fine. 1) java web app and 2) postgresql

$ docker logs ottoserver_web_1
...............
INFO  [2016-01-05 17:15:27,477] org.eclipse.jetty.server.handler.ContextHandler: Started i.d.j.MutableServletContextHandler@5d3b58ca{/admin,null,AVAILABLE}
INFO  [2016-01-05 17:15:27,499] org.eclipse.jetty.server.ServerConnector: Started otto-server@2620e717{HTTP/1.1}{0.0.0.0:40014}
INFO  [2016-01-05 17:15:27,499] org.eclipse.jetty.server.Server: Started @5974ms

Tried to ping web app running on docker-machine (port 2204 set in docker-compose.yml file) $ open "http://$(docker-machine ip default):2204"

docker container status

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                              NAMES
f06362ad29cb        ottoserver_web      "bash -c 'java -Djava"   51 minutes ago      Up 15 minutes       0.0.0.0:2204->2204/tcp, 8080/tcp   ottoserver_web_1
1d1dcc7f84e4        postgres            "/docker-entrypoint.s"   4 weeks ago         Up 15 minutes       5432/tcp                           ottoserver_herokuPostgresql_1

Please let me know if you need any other details.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 30 (6 by maintainers)

Most upvoted comments

If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.

For more information about reporting issues, see CONTRIBUTING.md.

You don’t have to include this information if this is a feature request

(This is an automated, informational response)


BUG REPORT INFORMATION

Use the commands below to provide key information from your environment:

docker version: docker info:

Provide additional environment details (AWS, VirtualBox, physical, etc.):

List the steps to reproduce the issue: 1. 2. 3.

Describe the results you received:

Describe the results you expected:

Provide additional info you think is important:

----------END REPORT ---------

#ENEEDMOREINFO

you also need to forward port from your container to your host, using docker run -p flag

Docker container are running fine

Bipins-MacBook-Pro:otto-server bipinvaylu$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                              NAMES
f06362ad29cb        ottoserver_web      "bash -c 'java -Djava"   23 hours ago        Up 22 hours         0.0.0.0:2204->2204/tcp, 8080/tcp   ottoserver_web_1
1d1dcc7f84e4        postgres            "/docker-entrypoint.s"   4 weeks ago         Up 22 hours         5432/tcp                           ottoserver_herokuPostgresql_1

@HackToday I checked with curl, here is output:

Bipins-MacBook-Pro:otto-server bipinvaylu$ docker-machine ip default
192.168.99.100
Bipins-MacBook-Pro:otto-server bipinvaylu$ curl -v http://192.168.99.100:2204/ping
*   Trying 192.168.99.100...
* connect to 192.168.99.100 port 2204 failed: Connection refused
* Failed to connect to 192.168.99.100 port 2204: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.99.100 port 2204: Connection refused
Bipins-MacBook-Pro:otto-server bipinvaylu$ curl -v http://192.168.99.100:40014/ping
*   Trying 192.168.99.100...
* connect to 192.168.99.100 port 40014 failed: Connection refused
* Failed to connect to 192.168.99.100 port 40014: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.99.100 port 40014: Connection refused
Bipins-MacBook-Pro:otto-server bipinvaylu$ 

@bipinvaylu 192.168.99.101 could not connect to 8080 and what should i do to make docke_host and docker_host_ip same. tired and not able to find solution any were