lundi 31 août 2015

Deploying Docker to AWS Elastic Beanstalk -- how to forward port to host? (-P flag)

I have a project set up with CircleCI that I am using to auto-deploy to Elastic Beanstalk. My EBS environment is a single container, auto-scaling, web environment. I am trying to run a service that listens on raw socket port 8080.

My Dockerfile:

FROM golang:1.4.2

...

EXPOSE 8080

My Dockerrun.aws.json.template:

{
  "AWSEBDockerrunVersion": "1",
  "Authentication": {
    "Bucket": "<bucket>",
    "Key": "<key>"
  },
  "Image": {
    "Name": "project/hello:<TAG>",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "8080"
    }
  ]
}

I have made sure to expose port 8080 on the "role" assigned to my project environment.

I used the exact deployment script from the CircleCI tutorial linked above (except with changed names).

Within the EC2 instance that is running my EBS application, I can see that the Docker container has run successfully, except that Docker did not forward the exposed port to the host container. I have encountered this in the past when I ran docker run .... without the -P flag. How can I force this behavior in my application?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire