Docker ports are working on the localhost but not with public ip

0 votes

I have started with docker and i have the next docker-compose when I ran (docker-compose up) a command, it worked when I used curl localhost  but when i tried to access from the public ip, it didn't worked, the connection timedout.

version: '3'
services:
  db:
   environment:
     - POSTGRES_PASSWORD=mipass
     - POSTGRES_USER=miuser
     - POSTGRES_DB=pdfdd
   image: postgres:9.6
  web:
   restart: always
   tty: true
   stdin_open: true
   build: .
   command: python ./code/manage.py runserver 0.0.0.0:8000
   volumes:
     - .:/code
   ports:
     - "8000:8000"
   depends_on:
     - db
  nginx:
    restart: always
    build: ./nginx/
    ports:
      - "80:80"
    volumes:
      - /www/static
      - .:/code
    links:
      - web:web

Can anyone help me with this query?
Thanks.
Jun 12, 2018 in Docker by Atul
• 10,240 points
4,202 views

1 answer to this question.

0 votes
Probably, the reason is that you've included the amazon-ec2 tag on your post. As you are running it there, you should configure the included firewall to permit your newly opened ports.

If you are still unable unable to resolve it, just look into the following documentation, Opening port 80 EC2 Amazon web services for instructions
answered Jun 12, 2018 by Damon Salvatore
• 5,980 points

edited Oct 15, 2018 by Kalgi

Related Questions In Docker

+2 votes
5 answers

Where are Docker images stored on the host machine?

The contents of the /var/lib/docker directory vary ...READ MORE

answered Jul 18, 2018 in Docker by Kalgi
• 2,680 points
12,455 views
+1 vote
0 answers

Not able to access the nginx container from IE or Chrome but from host service I can do curl http://localhost:port number

Not able to access the nginx container ...READ MORE

Aug 13, 2019 in Docker by anonymous
2,005 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,738 views
0 votes
1 answer

How do I install phantomjs with node in docker

Here is what you can try. Link for existing ...READ MORE

answered Aug 1, 2018 in Docker by Damon Salvatore
• 5,980 points
5,863 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP