Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy image to AWS Elastic Beanstalk from private Docker repo

I'm trying to pull Docker image from its private repo and deploy it on AWS Elastic Beanstalk with the help of Dockerrun.aws.json packed in zip. Its content is

{
    "AWSEBDockerrunVersion": "1",
    "Authentication": {
        "Bucket": "my-bucket",
        "Key": "docker/.dockercfg"
    },
    "Image": {
        "Name": "namespace/repo:tag",
        "Update": "true"
    },
    "Ports": [
        {
            "ContainerPort": "8080"
        }
    ]
}

Where "my-bucket" is my bucket's name on s3, which uses the same location as my BS environment. Configuration that's set in key is the result of

$ docker login

invoked in docker2boot app's terminal. Then it's copied to folder "docker" in "my-bucket". The image exists for sure. After that I upload .zip with dockerrun file to EB and on deploy I get

Activity execution failed, because: WARNING: Invalid auth configuration file

What am I missing? Thanks in advance

like image 823
Egor Litvinchuk Avatar asked Jul 14 '15 00:07

Egor Litvinchuk


People also ask

How do you deploy a web application from a Docker container to Elastic Beanstalk?

Use the Elastic Beanstalk CLI (EB CLI) to configure your local repository for deployment to Elastic Beanstalk. Set your application's Dockerfile at the root of the directory. (Optional) Use the eb local run command to build and run your container locally. To learn more about the eb local command, see eb local.

Does Elastic Beanstalk support Docker?

Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment.


1 Answers

Docker has updated the configuration file path from ~/.dockercfg to ~/.docker/config.json. They also have leveraged this opportunity to do a breaking change to the configuration file format.

AWS however still expects the former format, the one used in ~/.dockercfg (see the file name in their documentation):

{
  "https://index.docker.io/v1/": {
    "auth": "__auth__",
    "email": "__email__"
  }
}

Which is incompatible with the new format used in ~/.docker/config.json:

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "__auth__",
            "email": "__email__"
        }
    }
}

They are pretty similar though. So if your version of Docker generates the new format, just strip the auths line and its corresponding curly brace and you are good to go.

like image 73
aymericbeaumet Avatar answered Sep 30 '22 12:09

aymericbeaumet