I am learning AWS Lambda. Unfortunately, I can't install SAM-TOOLKIT (sam-cli) on my host computer MAC, but I have Docker installed.
Now, I work inside Docker flawlessly. I have started the docker-container (from base image of Linux Ubuntu) and have installed all necessary softwares inside the Container like "sudo", "JDK", "maven", "vim", "aws-cli", "sam-cli", etc.
I am perfectly able to run and execute "sam build" && "sam deploy" commands inside my docker-container, but when I try to execute the command like sam local invoke HelloWorldFunction/ --event events/testEventWithOneParameter.json
I am getting below error :-
Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?
How do I now solve this problem of having Docker inside Docker ? Your early response shall be highly appreciated ?
You have few options here. Docker in Docker is common use-case these days and there are more than one solutions to achieve this. You can use docker.sock
or dind
to run docker command inside container or create docker image in a container itself.
Reference walkthrough: https://devopscube.com/run-docker-in-docker/