Is it possible to edit the data returned by docker inspect?

Solution 1:

as johnharris85 says.
until now (17.12) docker no api to edit container's most options.

the only thing we can do is edit config files on disk:


generally, the config was in folder /var/lib/docker/containers/<conainerID>*/

  • config.v2.json
  • hostconfig.json

edit them, restart docker service, new config will load.

// tested in docker 17.12

see also: https://stackoverflow.com/a/49371983/4896468

Solution 2:

No it's not possible to edit the 'built in' configuration and state information returned by docker inspect. However if you want to add information to docker inspect then you can look into adding labels to your images / containers and then introspecting that (as label information is returned by docker inspect).

Official docs on Labelling (various different objects) can be found here.

Tags:

Docker