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?
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?
一. Manual modification
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>*/
edit them, restart docker service, new config will load.
// tested in docker 17.12
see also: https://stackoverflow.com/a/49371983/4896468
二. about
Synology NAS
dockerRecently I realized the docker cmd in
Synology NAS DSM system
has ability to edit container setttings via cmdline or webgui (without re-create it, or fully restat docker service)the cmdline
here is the
docker update
diff:the WebGUI
--
I'm not sure where to get this enhanced version docker.
wish someday this can be implemented in offical version.
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 todocker inspect
then you can look into adding labels to your images / containers and then introspecting that (as label information is returned bydocker 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 ofdocker inpect <containerID>
During a docker update, the default runtime changed from
oci
torunc
and I was unable to restart a stack of containers. Output fromsudo 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>