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
250 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,510 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,843 views
+1 vote
0 answers
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,520 points
136 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,510 points
555 views
0 votes
1 answer