Home > Enterprise >  Accessing a docker web app running on Ubuntu AWS via the internet (http://... 80)
Accessing a docker web app running on Ubuntu AWS via the internet (http://... 80)

Time:05-27

I am very new to docker. I have inherited some code which was running in a unknown configuration to publish a website (with a MYSQL backend). I am trying to install and run this on AWS ubuntu linux server.

I have managed to successfuly finish docker compose with the following result:

docker compose

docker ps

is successful docker ps

This is supposed to run a website that I want to access via the internet. I have opened up port 80 in the security group of the EC2.

However when I visit the page http://...:80 i don't see anything.

I suspect this is something very simple that I am missing. Appreciate any help.

CodePudding user response:

It could be a lot of different issues, but a simple thing that a lot of people miss, is opening the port for the container by adding this line to your service in the docker-compose.yml file

ports:
  - "80:80"

to open port 80 in this case.

CodePudding user response:

By default, when you create or run a container using docker create or docker run, it does not publish any of its ports to the outside world.

You can use -p 8080:80 to map TCP port 80 in the container to port 8080 on the ec2 host.

  • Related