简体   繁体   English

我的 Docker 容器在 AWS EC2 Ubuntu 实例上运行。 当我 go 到公共 IPv4 DNS 时,我的浏览器显示“拒绝连接”。

[英]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.我在我的 EC2 实例上安装了 Docker 和 Docker-Compose。

I'm launching the container with the command "sudo docker-compose up."我正在使用命令“sudo docker-compose up”启动容器。

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

Here's my docker-compose.yml:这是我的 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/ ).虽然无法通过公共 IPv4 DNS ( https://ec2-52-90-91-101.compute-1.amazonaws.com/ ) 访问我的应用程序,但可以通过公共 IPv4 地址 ( http: //52.90.91.101:3000/ )。

The inability of the front and back end of my apps to connect is a separate issue.我的应用程序的前端和后端无法连接是一个单独的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS EC2 - 公共 IPv4 地址无法在正在运行的 EC2 实例上运行 - AWS EC2 - Public IPv4 address not working on a running EC2 instance AWS EC2 实例连接在浏览器中被拒绝 - AWS EC2 Instance Connection Refused in browser 无法将我的 AWS EC2 实例连接到我的 GitHub Webhook - Cannot connect my AWS EC2 Instance to my GitHub Webhook AWS Neptune:尽管我可以从我的 EC2 实例连接到数据库,但笔记本电脑未连接 - AWS Neptune: Notebook Does Not Connect Though I Can Connect to the DB from my EC2 Instance 无法连接到 aws ec2 ubuntu 实例 - unable to connect to the aws ec2 ubuntu instance 我无法从我当前运行的 ec2 实例连接另一个具有相同密钥对的 ec2 实例 - I cannot connect another ec2 instance from my currently running ec2 instance both having the same key pair 我应该在哪里存储我的 object 在 AWS 运行 Ec2 实例与应用程序负载均衡器 - where should I store my object in AWS Running Ec2 Instance With Application Load balancer 使用 CDK 创建 AWS EC2 实例后如何获取公共 DNS? - How do I get public DNS after creating AWS EC2 instance with CDK? AWS Ec2 Ubuntu 实例运行 Angular 14 App - AWS Ec2 Ubuntu Instance Running Angular 14 App 如何连接到在 docker-compose 中运行并使用 ec2 实例部署的数据库? - How can I connect to database running in docker-compose and deployed with ec2 instance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM