Using "sam build" to create AWS image for lambda funtion in pipeline


I’m trying to build & deploy AWS lambda function by replicating local process in Codefresh pipeline.

In the pipeline I build image with all resources and execute sam build I get error - requires Docker. is Docker running? which totally makes sense - after all I’m executing commands inside docker image, which does not have docker inside. I tried to expose docker inside docker using

      - /var/run/docker.sock:/var/run/docker.sock

also without luck. So is there a way to sam build in Codefresh pipeline, or I need more programatical way of creating image ?

Hello and welcome to the Codefresh community

For security reasons the raw docker socket is not available in pipeline in the SAAS version of Codefresh. It is only available if you are using your own infrastructure with the Codefresh runner.
The proper way to use docker in a codefresh pipeline is via the build and push steps.

I am not an expert in Lambda but I think you with need to use the --container argument in the sam build command to inform sam that you already inside a container. Alternatively you should explore the sam package command.