Deploy containerized applications on AWS IoT Greengrass V2 running as a Docker container
Salih Bakir, Giuseppe Di Bella, and Gustav Svalander, Amazon Web Services
Summary
AWS IoT Greengrass Version 2, when deployed as a Docker container, doesn't natively support running Docker application containers. This pattern shows you how to create a custom container image based on the latest version of AWS IoT Greengrass V2 that enables Docker-in-Docker (DinD) functionality. With DinD, you can run containerized applications within the AWS IoT Greengrass V2 environment.
You can deploy this pattern as a stand-alone solution or integrate it with container orchestration platforms like Amazon ECS Anywhere. In either deployment model, you maintain full AWS IoT Greengrass V2 functionality including AWS IoT SiteWise Edge processing capabilities, while enabling scalable container-based deployments.
Prerequisites and limitations
Prerequisites
An active AWS account.
For general AWS IoT Greengrass Version 2 prerequisites, see Prerequisites in the AWS IoT Greengrass Version 2 documentation.
Docker Engine, installed and configured on Linux, macOS, or Windows.
Docker Compose (if you use the Docker Compose command line interface (CLI) to run Docker images).
A Linux operating system.
A hypervisor with a host server that supports virtualization.
System requirements:
2 GB of RAM (minimum)
5 GB of available disk space (minimum)
For AWS IoT SiteWise Edge, an x86_64 quad-core CPU with 16 GB of RAM and 50 GB of available disk space. For more information about AWS IoT SiteWise data processing, see Data processing pack requirements in the AWS IoT SiteWise documentation.
Product versions
AWS IoT Greengrass Version 2 version 2.5.3 or later
Docker-in-Docker version 1.0.0 or later
Docker Compose version 1.22 or later
Docker Engine version 20.10.12 or later
Limitations
Some AWS services aren’t available in all AWS Regions. For Region availability, see AWS Services by Region
. For specific endpoints, see Service endpoints and quotas, and choose the link for the service.
Architecture
Target technology stack
Data sources – IoT devices, sensors, or industrial equipment that generates data for processing
AWS IoT Greengrass V2 – Running as a Docker container with D-in-D capabilities, deployed on edge infrastructures
Containerized applications – Custom applications running within the AWS IoT Greengrass V2 environment as nested Docker containers
(Optional) Amazon ECS Anywhere – Container orchestration that manages the AWS IoT Greengrass V2 container deployment
Other AWS services – AWS IoT Core, AWS IoT SiteWise, and other AWS services for data processing and management
Target architecture
The following diagram shows an example target deployment architecture that uses Amazon ECS Anywhere, which is a container management tool.

The diagram shows the following workflow:
1: Container image storage – Amazon ECR stores the AWS IoT Greengrass container images and any custom application containers needed for edge processing.
2 and 3: Container deployment – Amazon ECS Anywhere deploys the AWS IoT Greengrass container image from Amazon ECR to the edge location, managing the container lifecycle and deployment process.
4: Component deployment – The deployed AWS IoT Greengrass core automatically deploys its relevant components based on its configuration. Components include AWS IoT SiteWise Edge and other necessary edge processing components within the containerized environment.
5: Data ingestion – After it’s fully configured, AWS IoT Greengrass begins ingesting telemetry and sensor data from various IoT data sources at the edge location.
6: Data processing and cloud integration – The containerized AWS IoT Greengrass core processes data locally using its deployed components (including AWS IoT SiteWise Edge for industrial data). Then, it sends processed data to AWS Cloud services for further analysis and storage.
Tools
AWS services
Amazon ECS Anywhere helps you deploy, use, and manage Amazon ECS tasks and services on your own infrastructure.
Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the AWS Cloud. You can launch as many virtual servers as you need and quickly scale them up or down.
Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service that’s secure, scalable, and reliable.
AWS IoT Greengrass is an open source Internet of Things (IoT) edge runtime and cloud service that helps you build, deploy, and manage IoT applications on your devices.
AWS IoT SiteWise helps you collect, model, analyze, and visualize data from industrial equipment at scale.
Other tools
Docker
is a set of platform as a service (PaaS) products that use virtualization at the operating-system level to deliver software in containers. Docker Compose
is a tool for defining and running multi-container applications. Docker Engine
is an open source containerization technology for building and containerizing applications.
Code repository
The code for this pattern is available in the GitHub AWS IoT Greengrass v2 Docker-in-Docker
Epics
| Task | Description | Skills required |
|---|---|---|
Clone and navigate to the repository. | To clone the repository, use the following command:
To navigate to the
| DevOps engineer, AWS DevOps |
Build the Docker image. | To build the Docker image with the default (latest) version, run the following command:
Or, to build the Docker image with a specific version, run the following command:
To verify the build, run the following command:
| AWS DevOps, DevOps engineer, App developer |
(Optional) Push to Amazon ECR. |
| App developer, AWS DevOps, DevOps engineer |
| Task | Description | Skills required |
|---|---|---|
Select authentication method. | Choose one of the following options:
| AWS administrator |
Configure authentication method. | For the authentication method you selected, use the following configuration guidance:
| AWS administrator |
| Task | Description | Skills required |
|---|---|---|
Configure | Update the
| DevOps engineer |
Start and verify container. | To start in the foreground, run the following command:
Or, to start in the background, run the following command:
To verify status, run the following command:
To monitor logs, run the following command:
| DevOps engineer |
| Task | Description | Skills required |
|---|---|---|
Run container with Docker CLI. |
| DevOps engineer |
Verify container. |
| DevOps engineer |
| Task | Description | Skills required |
|---|---|---|
Deploy applications. |
| App developer |
Access and test Docker-in-Docker. |
| DevOps engineer |
| Task | Description | Skills required |
|---|---|---|
Set up Amazon ECS cluster. |
| AWS administrator |
Deploy Amazon ECS task. |
| AWS administrator |
| Task | Description | Skills required |
|---|---|---|
Stop container. |
| DevOps engineer |
Troubleshooting
| Issue | Solution |
|---|---|
Container fails to start with permission errors. |
Warning
|
Provisioning fails with credential errors. | To verify credentials are configured correctly, use the following steps:
Make sure that IAM permissions include |
Cannot connect to Docker daemon inside container. |
|
Container runs out of disk space. |
Ensure minimum disk space: 5 GB for basic operations and 50 GB for AWS IoT SiteWise Edge |
Build issues. |
|
Network connectivity issues. |
Verify that the firewall allows outbound HTTPS (443) and MQTT (8883) traffic. |
Greengrass components fail to deploy. |
Check component-specific logs in the |
Container exits immediately after starting. |
Verify all required environment variables are set correctly if |
Related resources
AWS resources
Other resources
Additional information
For AWS IoT SiteWise Edge data processing, Docker must be available within the AWS IoT Greengrass environment.
To run a nested container, you must run the AWS IoT Greengrass container with administrator-level credentials.