This can be useful as part of a CI pipeline, for building Docker images inside a Docker container, see reference post
Docker doesn’t recommend running the daemon inside a container, however, a workaround is to mount the host machine socket in the container
docker run \
${IMAGE-NAME} \
-v /var/run/docker.sock:/var/run/docker.sock \
--name ${CONTAINER-NAME}