Development, testing, simulations are all good reasons towant to run AWS Greengrass Core in a docker container. This repo provides a simple Ubuntu-based Greengrass Core Docker image.
The trick to running it in Docker is to use devicemapper
storage driver instead of default overlay2
(thanks AWS support for digging it out).
CAUTION: when you change the Docker storage driver, you won't see the images and containers created with the old storage driver, until you change it back. Details here
docker build -t aws-greengrass .
-
Place your Greengrass Core certificates and keys under
certs/
-
Adjust
config.json
underconfig/
to point to the certificates and emailsWhen you create a Greengrass Core in AWS console, and Download and store your Core's security resources, the download contains the certificates and core configuration. Just copy them over here to
certs/
andconfig/
. -
Run the container:
docker run --rm -it \ -v "$PWD/certs":/greengrass/certs \ -v $PWD/config:/greengrass/config \ --privileged \ aws-greengrass
Or use docker-compose:
docker-compose up
You can build the image on MacOS and Windows, but can not run it.
The devicemapper
trick doesn't work for MacOS or Windows, as Docker doesn't support the devicemapper
storage driver there.
Instead, use the Vagrant Ubuntu VM: docker is installed and configured to use devicemapper
.
Create the VM with vagrant up
, log inside with vagrant ssh
,
and proceed with the steps before. Either pull the image from Docker Hub, or just rebuild it inside Vagrant VM.