Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Troubleshooting Docker Containers

This section lists the most common Elastic Beanstalk error messages related to Docker containers, the cause of the errors, and how to resolve or work around them. These errors cause your environment to fail to enter a healthy, Green status. Error messages can appear as events on the Elastic Beanstalk console Events page or in the tail logs.

Dockerfile Syntax Errors

Error Messages

The Events page displays the following sequence of error messages:

[Instance: <instance ID> Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed.

Failed to pull Docker image :latest: <date and timestamp> Invalid repository name (), only [a-z0-9-_.] are allowed. Tail the logs for more details.

Script /opt/elasticbeanstalk/hooks/appdeploy/enact/01build.sh failed with returncode 1

Additionally, the tail log displays the following series of error messages:

cat: Dockerrun.aws.json: No such file or directory

<date and timestamp> Invalid repository name (), only [a-z0-9-_.] are allowed

<date and timestamp> [ERROR] (1938 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/enact/01build.sh failed with returncode 1

Cause

The dockerfile is syntactically incorrect.

Solution

Check the syntax of the dockerfile using a JSON validator. Also verify the dockerfile contents against the requirements described in Single Container Docker Configuration.

Dockerrun.aws.json Syntax Errors

Error Messages

The Events page displays the following sequence of error messages:

[Instance: <instance ID> Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed.

Script /opt/elasticbeanstalk/hooks/appdeploy/enact/01build.sh failed with returncode 1

Failed to pull Docker image :latest: <date and timestamp> Invalid repository name (), only [a-z0-9-_.] are allowed. Tail the logs for more details.

Additionally, the tail logs display the following sequence of error messages:

parse error: Invalid numeric literal

<date and timestamp> Invalid repository name (), only [a-z0-9-_.] are allowed

[ERROR] (1942 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/enact/01build.sh failed with returncode 1

Cause

The dockerrun.aws.json file is syntactically incorrect.

Solution

Check the syntax of the dockerfile using a JSON validator. Also verify the dockerfile contents against <topic with dockerfile requirements>.

No EXPOSE Directive Found in Dockerfile

Error Messages

The Events page includes the following error message:

No EXPOSE directive found in Dockerfile, abort deployment

Cause

The dockerfile or the dockerrun.aws.json file does not declare the container port.

Solution

Do one of the following to declare the port exposed on the image:

  • In the dockerfile, include an EXPOSE instruction. For example:

    EXPOSE 80

  • In the dockerrun.aws.json file, include the Ports key. For example:

    {
        "Ports": [
          {
            "ContainerPort": "80"
          }
        ]
    }

    Note

    When the dockerfile exists and includes the EXPOSE instruction, Elastic Beanstalk ignores the Ports key and value in the dockerrun.aws.json file.

Invalid EC2 Key Pair and/or S3 Bucket in Dockerrun.aws.json

Error Messages

The Events page displays the following sequence of error messages:

[Instance: <instance ID> Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed.

Failed to download authentication credentials <repository> from <bucket name>

Script /opt/elasticbeanstalk/hooks/appdeploy/enact/01build.sh failed with returncode 1

Cause

The dockerrun.aws.json provides an invalid EC2 key pair and/or S3 bucket for the .dockercfg file. Or, the instance profile does not have GetObject authorization for the S3 bucket.

Solution

Verify that the .dockercfg file contains a valid S3 bucket and EC2 key pair. Grant permissions for the action s3:GetObject to the IAM role in the instance profile. For details, go to Managing Elastic Beanstalk Instance Profiles

Invalid auth configuration file

Error Messages

The Events page displays the following of error message:

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

Your authentication file (config.json) is not formatted correctly.

Solution

See Using Images From a Private Repository.