How to run AWS SAM CLI within a container as it requires "docker" daemon to be running?

I need to run aws-sam-cli within a docker container with a Ubuntu 20.04 base image but I am having trouble installing and running "docker" daemon into the container as "sam" depends on docker to be running.

docker in docker (dind) won’t help as it only allows someone to start a container within a container. In my case, "sam" needs to build and push things into a local docker registry and then deploy the built image into AWS ECR.
If I can build on the "docker" base image and add aws-cli and aws-sam-cli into it, it might help but I have not been successful doing so either.

Does anybody have a solution out there that allows docker registry to be running within a container?

Many thanks.

Source: Docker Questions

LEAVE A COMMENT