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

docker inspect returns all sorts of interesting information about a docker image or container (or another object).

Where is this information stored? Is it possible to edit it?

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

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.

Yes, @johnharris points out there is no direct editing api

@yurenchen is correct that editing /var/lib/docker/containers/<containerID>/hostconfig.json then restarting the docker daemon will update the output of docker inpect <containerID>

During a docker update, the default runtime changed from oci to runc and I was unable to restart a stack of containers. Output from sudo cat /var/lib/docker/<containerID>/hostconfig.json | jq .Runtime was "oci" but needed to be "runc" after update.

Manually started sudo docker start <short_containerID>

Depending on what you’re trying to achieve, you may be best off setting a label.