Troubleshooting Amazon IoT Greengrass in a Docker container - Amazon IoT Greengrass
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Troubleshooting Amazon IoT Greengrass in a Docker container

Use the following information to help you troubleshoot issues with running Amazon IoT Greengrass in a Docker container and to debug issues with Amazon IoT Greengrass in the Docker container.

Troubleshooting issues with running the Docker container

Use the following information to help troubleshoot issues with running Amazon IoT Greengrass in a Docker container.

Error: Cannot perform an interactive login from a non TTY device

This error can occur when you run the aws ecr get-login-password command. Make sure that you installed the latest Amazon CLI version 2 or version 1. We recommend that you use the Amazon CLI version 2. For more information, see Installing the Amazon CLI in the Amazon Command Line Interface User Guide.

Error: Unknown options: -no-include-email

This error can occur when you run the aws ecr get-login command. Make sure that you have the latest Amazon CLI version installed (for example, run: pip install awscli --upgrade --user). For more information, see Installing the Amazon Command Line Interface on Microsoft Windows in the Amazon Command Line Interface User Guide.

Error: A firewall is blocking file Sharing between windows and the containers.

You might receive this error or a Firewall Detected message when running Docker on a Windows computer. This can also occur if you are signed in on a virtual private network (VPN) and your network settings are preventing the shared drive from being mounted. In that situation, turn off VPN and re-run the Docker container.

Error: An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws-cn:iam::account-id:user/<user-name> is not authorized to perform: ecr:GetAuthorizationToken on resource: *

You might receive this error when running the aws ecr get-login-password command if you don't have sufficient permissions to access an Amazon ECR repository. For more information, see Amazon ECR Repository Policy Examples and Accessing One Amazon ECR Repository in the Amazon ECR User Guide.

Error: You have reached your pull rate limit

Docker Hub limits the number of pull requests that anonymous and Free Docker Hub users can make. If you exceed the rate limits for anonymous or free user pull requests, then you receive one of the following errors:

ERROR: toomanyrequests: Too Many Requests.
You have reached your pull rate limit.

To resolve these errors, you can wait for a few hours before you try another pull request. If you plan on consistently submitting a large number of pull requests, see the Docker Hub website for information about rate limits, and options for authenticating and upgrading your Docker account.

Debugging Amazon IoT Greengrass in a Docker container

To debug issues with a Docker container, you can persist the Greengrass runtime logs or attach an interactive shell to the Docker container.

Persist Greengrass logs outside of the Docker container

After you stop a Amazon IoT Greengrass container, you can use the following docker cp command to copy the Greengrass logs from the Docker container to a temporary logs directory.

docker cp container-id:/greengrass/v2/logs /tmp/logs

To persist logs even after a container exits or is removed, you must run the Amazon IoT Greengrass Docker container after bind-mounting the /greengrass/v2/logs directory.

To bind-mount the /greengrass/v2/logs directory, do one of the following when you run a new Amazon IoT Greengrass Docker container.

  • Include -v /tmp/logs:/greengrass/v2/logs:ro in your docker run command.

    Modify the volumes block in the Compose file to include the following line before you run your docker-compose up command.

    volumes: - /tmp/logs:/greengrass/v2/logs:ro

You can then check your logs at /tmp/logs on your host to see Greengrass logs while Amazon IoT Greengrass is running inside the Docker container.

For information about running Greengrass Docker containers, see Run Amazon IoT Greengrass in Docker with manual provisioning and Run Amazon IoT Greengrass in Docker with automatic provisioning

Attach an interactive shell to the Docker container

When you use docker exec to run commands inside the Docker container, those commands are not captured in the Docker logs. Logging your commands in the Docker logs can help you investigate the state of the Greengrass Docker container. Do one of the following:

  • Run the following command in a separate terminal to attach your terminal's standard input, output, and error to the running container. This enables you to view and control the Docker container from your current terminal.

    docker attach container-id
  • Run the following command in a separate terminal. This enables you to run your commands in interactive mode, even if the container is not attached.

    docker exec -it container-id sh -c "command > /proc/1/fd/1"

For general Amazon IoT Greengrass troubleshooting, see Troubleshooting Amazon IoT Greengrass V2.