'how to specify the docker run command with -v /var/run/docker.sock in AWS ECS using an EC2 container instance

Requirement:

I have a cli tool, which i need to use inside a docker container that will scan docker images. For that, the tool will need a docker image as an input parameter. that docker image should be pulled from a container registry inside the docker container before running the cli tool.

My setup looks like this:

I need to spin up an EC2 container instance in AWS ECS.
The container that I will be spinning up will have the following dockerfile and entrypoint.sh files. [provided at the end of the post].
If you can see, the entrypoint.sh file has a docker pull command.
For this command to run successfully, I need to use the following docker run command - in my local machine where i do the testing.

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

So, now ECS.. I think ECS automatically invokes a docker run command isn't it?

How can i specify my own docker run command which i want the ECS to invoke?

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

Or is it not required to specify a "docker run" instruction but 'only' the arguments it takes? if so where do i specify the arguments alone for the docker run instruction?

Dockerfile

FROM Ubuntu

COPY entrypoint.sh /
RUN chmod +x "/entrypoint.sh"

ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

#!/bin/sh
docker pull myregistry/image:tag

#command to run the cli tool
clitool myregistry/myimage:tag


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source