So I'm trying to run the following shell script which requires the container id/name of the container (in which the script would be run) dynamically.
One way could be to do docker ps and then getting the Container Id, but that won't be dynamic.
So is there a way to do this dynamically?
#!/bin/bash docker exec <container id/name> /bin/bash -c "useradd -m <username> -p <password>"
docker run? Also, if you are inside container already, maybe there is no need to run docker exec? And if you are outside, you anyway need to know name/id to exec.