DinD error run command to execute start container

I need to run one container (aws sam cli) inside another container for CI / CD, therefore I’m using docker: dind.

I’m doing a test before the final solution, follow the dockerfile:

FROM docker:dind
RUN apk update &&
apk upgrade &&
apk add bash &&
apk add --no-cache --virtual build-deps build-base gcc &&
apk add python &&
apk add python-dev libffi-dev openssl-dev gcc libc-dev make &&
apk add py-pip &&
pip install awscli &&
pip install aws-sam-cli
RUN sam init
WORKDIR /sam-app
RUN sam local invoke HelloWorldFunction --event event.json --region us-east-1
RUN sam local start-api --region us-east-1 --host 0.0.0.0

When I execute this file, I receive this error: Error: Running AWS SAM projects locally requires Docker. Have you got it installed? The command ‘/ bin / sh -c sam local start-api --region us-east-1 --host 0.0.0.0’ returned a non-zero code: 1

But, when I don’t use this lines:
RUN sam local invoke HelloWorldFunction - event.json region-us-east-1
RUN sam local start-api --region-us-east-1 – host 0.0.0.0

And start the container and run the sames commands inside container … it works.

Everyone, can I help me?

P.S .: Sorry for my English, I’m learning.