Skip to content

Instantly share code, notes, and snippets.

@thomashartm
Last active February 6, 2024 15:09
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomashartm/9d48aa8d9fad98ee06c368bd416d1f08 to your computer and use it in GitHub Desktop.
Save thomashartm/9d48aa8d9fad98ee06c368bd416d1f08 to your computer and use it in GitHub Desktop.
Enable AWS SAM local to run without Docker Desktop but Colima + Docker Daemon on MacOs

AWS SAM local commands without Docker Desktop

AWS SAM local commands check for the existance of DOCKER_HOST. If the variable is not present, it will fail with the following error message

Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?

Replace it with Colima

Point DOCKER_HOST to unix socket of the Docker Daemon. Colina creates it in the $HOME/.colima directory. Check the folder if the unix socket is present (docker.sock)

ls -la $HOME/.colima 

Now set the environment variable (better add it to your shell config in .zshenv)

export DOCKER_HOST="unix://$HOME/.colima/docker.sock"

Source it in your shell

source ~/.zshenv

Now rebuild your sam project

sam build -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment