-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: sam local cannot find Docker even when it is running #5646
Comments
And yes, I've tried restarting. 🙂 |
Thanks for raising this issue. I've installed Colima to see if I could get it working with SAM CLI. Apparently Colima sets a default context for Docker CLI so that you can communicate the Colima through that context configuration. But that is only available for Docker CLI, for any other clients (like SAM CLI which uses docker-py to communicate with Docker), you need to set So when I run
As you can see Colima sets socket file to a different location (default is
After setting this, SAM CLI should able to communicate through Docker APIs for its features. I just want to remind that, this should work in theory, however the alternative that you are using (Colima for this instance) should support Docker APIs that SAM CLI uses with its minimum required Docker API version. If there are some discrepancies about how those APIs are implemented, then you might see some unexpected behavior. |
NAME DESCRIPTION DOCKER ENDPOINT ERROR
colima * colima unix:///Users/varungawande/.colima/default/docker.sock
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux Docker Desktop unix:///Users/varungawande/.docker/run/docker.sock I tried changing it here but it didn't work. Okay but exporting that |
@mndeveci should the info in #5646 (comment) be added to the troubleshooting doc: Currently that doc doesn't have an item for "Docker is not reachable. Mentioning |
@justinmk3 good suggestion, started a thread with our documentation team about updating the troubleshooting section. @V4G4X Colima uses a differet socket location and we need to set it up so that SAM CLI (or specifically docker-py) library can pick it up. You don't see this issue with Docker CLI since Colima automatically configures it through its context as I explained above. |
Resolving this issue now, please let us know if you have further questions. |
|
This shell command worked for me |
# colima-intel-context
alias colima-intel-context='export DOCKER_HOST="$(docker context inspect colima-intel -f '\''{{.Endpoints.docker.Host}}'\'')"' |
Found this issue at many places but they were all closed and I was unable to open them.
Nor did the workaround there work for me, i.e
sudo ln -sf "$HOME/.docker/run/docker.sock" /var/run/docker.sock
Description:
On
sam local invoke/start-api
SAM complains that Docker is not running. Where as it is.docker ps
works, anddocker/getting-started
is actually running on the side.I am using Colima as opposed to Docker Desktop, but this issue existed even back then. I moved to colima for this reason.
Steps to reproduce:
colima start --arch x86_64
docker ps
and verify that it's working.sam init
and get a basic stack going.sam build
sam local start-api
Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?
Observed result:
Expected result:
Local Api is now active or some success like that.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --info;
Docker Version:
Docker version 24.0.5, build ced0996600
Docker Path:
/opt/homebrew/bin/docker
Colima Version:
Colima Path:
/opt/homebrew/bin/colima
SAM Version:
SAM CLI, version 1.94.0
SAM Path:
/usr/local/bin/sam
OS Details:
Darwin Varuns-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
The text was updated successfully, but these errors were encountered: