AWS SAM: Build Failed Error: Docker is unreachable. Docker needs to be running to build inside a container

Viewed 4256

Im running AWS SAM and using sam build --use-container then get the following error.

Starting Build inside a container Building function 'SamTutorialFunction Build Failed Error: Docker is unreachable. Docker needs to be running to build inside a container

I run sudo service docker start before and still get the same error.

2 Answers

I had the same issue. The problem was that docker was installed to run as the root user. AWS SAM is trying to access as your logged in user. You can set docker to run as non-root user (without sudo) by adding your user to the docker group. See https://docs.docker.com/engine/install/linux-postinstall/

Related