Reputation: 319
I have question-related to port mapping on Elastic Beanstalk multiple Docker-container-env.
My Dockerrun.aws.json looks like this:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "web",
"image": "exampleimage",
"hostname": "web",
"essential": true,
"memory": 128,
"portMappings": [
{
"hostPort": 3000,
"containerPort": 80
}
]
}
]
}
And my web dockerfile look like this:
FROM node:alpine as builder
WORKDIR '/app'
COPY ./package.json ./
RUN npm install
COPY . .
FROM nginx
EXPOSE 80
COPY --from=builder /app/build /usr/share/nginx/html
# at the end its a nginx images
Does this mean my docker container running on port 80, and I make it on host port 3000?
If on my AWS Elastic Beanstalk the endpoint is like
url-something-like-this-xxxx.com
How can I access the container?
url-something-like-this-xxxx:3000.com. ??
Thank you so much!
Upvotes: 0
Views: 1477
Reputation: 131
The correct syntax for accessing a different port other than then one specified by the protocol is ://: Examples
Accessing a website over http on port 3000
Accessing a website over https on port 8443
Also make sure the security group attached to your instance or load balancer allows access on port 3000 from your IP address or 0.0.0.0/0 if you want it to be public
Link to guide on updating security groups.
https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#AddRemoveRules
Upvotes: 1