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,220 points
209 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,450 points

edited Oct 15, 2018 by Kalgi

Related Questions In Docker

+1 vote
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,620 points
1,363 views
+1 vote
4 answers

COPY is not working in Docker

I had the exact same issue. I ...READ MORE

answered May 6 in Docker by Emilia
783 views
0 votes
1 answer
0 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
• 56,140 points
81 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,450 points
373 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.