简体   繁体   中英

My Docker container is running on an an AWS EC2 Ubuntu instance. When I go to the Public IPv4 DNS, my browser shows "refused to connect."

When I run my container locally, everything works fine.

I've installed Docker and Docker-Compose on my EC2 instance.

I'm launching the container with the command "sudo docker-compose up."

https://ec2-52-90-91-101.compute-1.amazonaws.com/

Here's my docker-compose.yml:


version: '3.2'

services:
  server:
    build:
      context: ./server
      dockerfile: Dockerfile
    image: mern-docker-project-server
    container_name: mern-docker-project-node-server
    ports:
      - "5000:5000"
    depends_on:
      - mongo
    env_file: ./server/.env

    networks:
      - app-network

  mongo:
    image: mongo
  
    ports:
      - "27017:27017"
    networks:
      - app-network

  client:
    build:
      context: ./client
      dockerfile: Dockerfile
    image: mern-docker-project-client
    container_name: mern-docker-project-react-client
    depends_on:
      - server
    ports:
      - "3000:3000"
    networks:
      - app-network

networks:
    app-network:
        driver: bridge

   

While my app wasn't accessible by way of the Public IPv4 DNS ( https://ec2-52-90-91-101.compute-1.amazonaws.com/ ), it is accessible through the Public IPv4 address ( http://52.90.91.101:3000/ ).

The inability of the front and back end of my apps to connect is a separate issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM