Error: Docker is unreachable. Docker needs to be running to build inside a container.
When I ran a build with sam build --use-container, the following error occurred.
1 | Error: Docker is unreachable. Docker needs to be running to build inside a container. |
Specifying DOCKER_HOST
Check the current context.
1 | docker info | grep 'Context:' |
Check the endpoint.
1 | docker context ls | grep desktop-linux |
By specifying DOCKER_HOST and running the command again, I was able to avoid the error.
1 | env SAM_CLI_TELEMETRY=0 \ |
That’s all.
For your reference.
Error: Docker is unreachable. Docker needs to be running to build inside a container.
https://kenzo0107.github.io/en/2024/08/27/docker-is-unreachable/