1

For example, I run a docker by docker run -d --name sonarqube -p 19000:9000 -p 19002:9002 -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=123 --link sonarqube-mysql:mysql.

Then I lost my shell command history, but I want to know all my arguments. How can I get them? (I need the arguments to copy/move/restart container)

Fancyoung
  • 2,313
  • 26
  • 32

2 Answers2

6

Of course docker inspect is the way to go, but if you just want to "reconstruct" the docker run command, you have

https://github.com/nexdrew/rekcod

it says

Reverse engineer a docker run command from an existing container (via docker inspect).

user2915097
  • 30,758
  • 6
  • 57
  • 59
  • This works pretty well, though I've already ran into cases where rekcod is quite wrong. It's a good pointer in the right direction. But you will definitely want to filter out some of the extraneous flags at a minimum. – Bruno Bronosky May 06 '17 at 03:54
  • Log a PR on the rekcod site so it will be fixed – user2915097 May 06 '17 at 05:38
2

docker inspect CONTAINER_NAME gives you that information.

Check docker inspect reference to see all available options: https://docs.docker.com/engine/reference/commandline/inspect/

kstromeiraos
  • 4,659
  • 21
  • 26
  • 1
    Thanks, I tried inspect before, but there are so many data, it's hard to find out which is default value, which is not. – Fancyoung Apr 28 '17 at 08:25