I use AWS CodePipeline to deploy a multicontainer docker app on Elastic Beanstalk. The app requires attaching a file system from EFS as a mounted volume. In order to attach and have access to the volume, it appears I need to restart docker. This is explained in this question: Using AWS EFS with Docker. While I can successfully attach the file system based on those instructions, my deployment sometimes “fails” with the following error:
Action execution failed Deployment completed, but with errors: ECS task stopped due to: Task failed to start. Failed to start ECS task: arn:aws… is STOPPED.
In these cases the app successfully deploys, and is fully functional, but I receive a failure message because docker had not restarted yet during that check.
When this occurs I see the following in my Beanstalk logs:
-------------------------------------
/var/log/ecs/ecs-init.log
-------------------------------------
2020-04-27T15:06:41Z [INFO] pre-start
2020-04-27T15:06:44Z [INFO] start
2020-04-27T15:06:44Z [INFO] No existing agent container to remove.
2020-04-27T15:06:44Z [INFO] Starting Amazon Elastic Container Service Agent
2020-04-27T15:07:20Z [INFO] Agent exited with code 0
2020-04-27T15:07:20Z [INFO] Error connecting to docker, backing off for 1.14777941s, error: Get http://unix.sock/v1.25/version: dial unix /var/run/docker.sock: connect: no such file or directory
2020-04-27T15:07:21Z [INFO] Error connecting to docker, backing off for 2.282153551s, error: Get http://unix.sock/v1.25/version: dial unix /var/run/docker.sock: connect: no such file or directory
2020-04-27T15:07:23Z [INFO] post-stop
2020-04-27T15:07:23Z [INFO] Cleaning up the credentials endpoint setup for Amazon Elastic Container Service Agent
2020-04-27T15:07:23Z [INFO] pre-start
2020-04-27T15:07:23Z [INFO] start
2020-04-27T15:07:23Z [INFO] Container name: /ecs-agent
2020-04-27T15:07:23Z [INFO] Removing existing agent container ID:
2020-04-27T15:07:23Z [INFO] Starting Amazon Elastic Container Service Agent
Is there a way to prevent these false failures?