Docker ports work in localhost but not with public ip

I`m starting with docker i have the next docker-compose when i run docker-compose up all with success, when i do curl localhost works fine but when i try to access from the public ip dont works the connection timeout.

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

  • Docker scale with one-to-one links
  • Running an iPython notebook server on an EC2 Ubuntu instance via Docker
  • Switching off AWS instance automatically once a job is done
  • Docker exit status 1 for Node app on AWS
  • How to send application logs from docker to cloudwatch
  • lxc-attach failed to enter the namespace - EC2 Instances
  • access mysql with kubernetes : access denied for user root
  • npm commands fails in jenkins pipelines with docker
  • Docker Compose and execute command on starting container
  • Angular 2 Webpack Docker Error On development
  • Is there any solution to execute binary in container that mount from host?
  • Rancher Docker container UI unreacheable on 8080 port
  • One Solution collect form web for “Docker ports work in localhost but not with public ip”

    Thanks @BMitch, i forgot to open 80 port in security group if someone have the same error please see Opening port 80 EC2 Amazon web services for instructions.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.