Greengrass component install fails - pulling from docker hub

0

Only sometimes the component install fails as it cannot pull the docker image - its as though it cant connect to docker hub. I'm not sure why this error is occuring and only some of the time, how can i resolve this from happening?:

{
  "RecipeFormatVersion": "2020-01-25",
  "ComponentName": "Onwatch.mqttBroker",
  "ComponentVersion": "2.1.0",
  "ComponentType": "aws.greengrass.generic",
  "ComponentDescription": "",
  "ComponentPublisher": "Me",
  "ComponentDependencies": {
    "aws.greengrass.TokenExchangeService": {
      "VersionRequirement": ">=2.0.0 <3.0.0",
      "DependencyType": "HARD"
    }
  },
  "Manifests": [
    {
      "Platform": {
        "os": "linux"
      },
      "Name": "Onwatchv3",
      "Lifecycle": {
        "Run": {
          "Script": "docker run --network=host --restart always -v {artifacts:path}/mosquitto.conf:/mosquitto/config/mosquitto.conf --name mqttbroker eclipse-mosquitto",
          "RequiresPrivilege": "true"
        },
        "Shutdown": {
          "Script": "docker stop mqttbroker && docker rm mqttbroker"
        },
        "Recover": {
          "Script": "docker stop mqttbroker && docker rm mqttbroker"
        }
      },
      "Artifacts": [
        {
          "Uri": "s3://docker/mosquitto.conf"
          }
        }
      ]
    }
  ],
  "Lifecycle": {}
}
2023-05-30T01:51:56.314Z [INFO] (pool-2-thread-25) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STARTING, command=["docker run --rm --network host --mount source=onwatch_mqttbroker-plugin-data,t..."]}
2023-05-30T01:51:56.979Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Unable to find image 'eclipse-mosquitto:latest' locally. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:51:58.447Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/eclipse-mosquitto/manifests/latest": dial tcp: lookup registry-1.docker.io on 192.168.1.1:53: no such host.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:51:58.449Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. See 'docker run --help'.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:51:58.455Z [INFO] (Copier) onwatch.mqttbroker-plugin: Run script exited. {exitCode=125, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:51:58.495Z [INFO] (pool-2-thread-23) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING, command=["docker stop mqttbroker-plugin"]}
2023-05-30T01:51:59.114Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Error response from daemon: No such container: mqttbroker-plugin. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING}
2023-05-30T01:51:59.133Z [WARN] (pool-2-thread-23) onwatch.mqttbroker-plugin: shell-runner-error. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING, command=["docker stop mqttbroker-plugin"]}
2023-05-30T01:51:59.189Z [INFO] (pool-2-thread-23) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STARTING, command=["docker run --rm --network host --mount source=onwatch_mqttbroker-plugin-data,t..."]}
2023-05-30T01:51:59.885Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Unable to find image 'eclipse-mosquitto:latest' locally. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:02.882Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. latest: Pulling from library/eclipse-mosquitto. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:02.934Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. docker: Get "https://registry-1.docker.io/v2/library/eclipse-mosquitto/manifests/sha256:3fa30df278df1cb55009863d0c020f96765c986c878e96a50202a3b47a7e62a8": dial tcp: lookup registry-1.docker.io on 192.168.1.1:53: no such host.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:02.935Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. See 'docker run --help'.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:02.979Z [INFO] (Copier) onwatch.mqttbroker-plugin: Run script exited. {exitCode=125, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:03.033Z [INFO] (pool-2-thread-7) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING, command=["docker stop mqttbroker-plugin"]}
2023-05-30T01:52:04.231Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Error response from daemon: No such container: mqttbroker-plugin. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING}
2023-05-30T01:52:04.355Z [WARN] (pool-2-thread-7) onwatch.mqttbroker-plugin: shell-runner-error. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STOPPING, command=["docker stop mqttbroker-plugin"]}
2023-05-30T01:52:04.504Z [INFO] (pool-2-thread-7) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=STARTING, command=["docker run --rm --network host --mount source=onwatch_mqttbroker-plugin-data,t..."]}
2023-05-30T01:52:05.707Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Unable to find image 'eclipse-mosquitto:latest' locally. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:08.695Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. latest: Pulling from library/eclipse-mosquitto. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:08.743Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. docker: Get "https://registry-1.docker.io/v2/library/eclipse-mosquitto/manifests/sha256:3fa30df278df1cb55009863d0c020f96765c986c878e96a50202a3b47a7e62a8": dial tcp: lookup registry-1.docker.io on 192.168.1.1:53: no such host.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:08.744Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. See 'docker run --help'.. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Run.Script, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:08.879Z [INFO] (Copier) onwatch.mqttbroker-plugin: Run script exited. {exitCode=125, serviceName=onwatch.mqttbroker-plugin, currentState=RUNNING}
2023-05-30T01:52:08.900Z [INFO] (pool-2-thread-7) onwatch.mqttbroker-plugin: shell-runner-start. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=BROKEN, command=["docker stop mqttbroker-plugin"]}
2023-05-30T01:52:10.178Z [WARN] (Copier) onwatch.mqttbroker-plugin: stderr. Error response from daemon: No such container: mqttbroker-plugin. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=BROKEN}
2023-05-30T01:52:10.206Z [WARN] (pool-2-thread-7) onwatch.mqttbroker-plugin: shell-runner-error. {scriptName=services.onwatch.mqttbroker-plugin.lifecycle.Shutdown.Script, serviceName=onwatch.mqttbroker-plugin, currentState=BROKEN, command=["docker stop mqttbroker-plugin"]}

asked 10 months ago207 views
1 Answer
0

Greengrass provides support for pulling images from DockerHub and ECR using the Docker application manager component. Using this component ensures that the image has been pulled locally before shutting down the current version of the component and executing the Run lifecycle script, minimizing the downtime of the component.

Another suggestion is to not use "RequiresPrivilege": "true" since that would run the container as root. Assuming you are using the default configuration of Greengrass, ie running the components as ggc_user:ggc_group, I would recommend to add ggc_user to the docker group in order to enable that user to run docker.

sudo usermod -aG docker ggc_user

The following guide provides a comprehensive description on how to run docker containers with Greengrass: https://docs.aws.amazon.com/greengrass/v2/developerguide/run-docker-container.html

AWS
EXPERT
answered 10 months ago
  • Thanks for your answer - I will look at using the docker application manager, however it does not address the root of the problem I have found. Even if I use the pull command from the terminal on the device I get the same error. I am connected to the internet, not sure why this problem happens intermittently

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions