-1

How can i get the full docker run commandline within the container?

I need this for protocols.

eg

docker run -d -e foo=bar -v $PWD:/app image

docker exec -it container bash
# get commandline ??

many thanks

Mrprimus
  • 59
  • 1
  • 5

1 Answers1

0

docker itself does not offer a straight-forward way to get the actual command which started a container. But you can docker inspect the container and reconstruct the command which started it from that.

There are some tools trying to automate this such as runlike, rekcod or this template for docker inspect, see How to show the run command of a docker container for more in this.

If you want to get this information inside a running container you'll have to mount the docker socket into it to be able to use these tools inside the container, see Access Docker socket within container.

acran
  • 7,070
  • 1
  • 18
  • 35