I am trying to use AWS Greengrass to deploy docker containers to IoT devices (the devices have docker installed on them already) and am following the instructions provided by AWS to do this: https://docs.aws.amazon.com/greengrass/v2/developerguide/run-docker-container.html
Basically, I created a component using the GDK CLI, with the command
gdk component init -l python -t HelloWorld
For context, this is what my recipe.yaml file looks like:
RecipeFormatVersion: '2020-01-25'
ComponentName: com.example.DockerTest
ComponentVersion: '1.0.0'
ComponentDescription: 'Uses Greengrass to deploy NodeRed and Mosquitto to docker containers on the IoT devices.'
ComponentPublisher: Amazon
ComponentDependencies:
aws.greengrass.DockerApplicationManager:
VersionRequirement: ~2.0.0
Manifests:
- Platform:
os: all
Lifecycle:
run: docker-compose -f {artifacts:path}/docker-compose.yaml up
Artifacts:
- URI: "docker:nodered/node-red:latest"
- URI: "docker:eclipse-mosquitto:latest"
- URI: "s3://<valid s3 path>/docker-compose.yml"
And this is the docker-compose.yml file stored in the s3 bucket:
version: "3"
services:
nodered:
image: "nodered/node-red:latest"
ports:
- "1880:1880"
mqtt:
image: "eclipse-mosquitto:latest"
ports:
- "1883:1883"
When I deployed it to my raspberry pi at home, however, I got this error in the component logs on the raspberry pi, which has docker installed:
[WARN] (Copier) com.smartbeej.DockerTest: stderr. sh: 1: docker-compose: not found.
Running docker container ls on the raspberry pi showed no containers running as well. What am I doing wrong?
After some peer progamming, I have figured out the solution:
docker-composedoes not refer to thedocker-compose.ymlfile. It instead refers to thedocker-composecommand. To fix this, you can do one of two things:docker-composecommand on your IoT device: https://docs.docker.com/compose/install/standalone/docker composeplugin on your IoT device: https://docs.docker.com/compose/install/linux/and change the Lifecycle command in the
recipe.yamlfromdocker-composetodocker compose