If your containers are running on the same host, you can run docker commands inside the container, by exposing the docker socket to the container.
To achieve this, when running the container, mount the docker.sock as such:
docker run -v /var/run/docker.sock:/var/run/docker.sock ...
Now you can execute docker commands from within the container.