I have some container running for a while. so the bash history is already filled in with other commands. So how can I now extract the initial command I used to start container with all its parameters?
Asked
Active
Viewed 1,786 times
-1
-
Have you tried `docker container inspect
`? Inside that json you can find the `CMD` you used. – tgogos May 08 '18 at 11:43 -
hi. nope. it is not helping. it is only shown params i have passed inside the contaone. but it does not show params i have passed to the docker itself. e.g. what folders\ports i have forwarded... – Roman May 08 '18 at 12:29
1 Answers
0
So how can I now extract the initial command I used to start container with all its parameters?
Since your current history is overwritten and you can't extract original calling line from there you have to recreate it. Best effort you can do is:
docker inspect <container>
Regardless if your container is stopped or started, there you have all necessary information about container (entry point, command, ports, environment variables...) that can help you regenerate exact arguments to run.

Const
- 6,237
- 3
- 22
- 27