容器启动后,如果想要修改容器挂载信息或其他配置信息,不重新删除容器的话,可以停止容器后修改容器配置文件,修改时需要先停止容器
# 查看容器IDdocker ps# 停止容器docker stop 容器ID# 此目录下文件夹对应容器列表cd /var/lib/docker/containerscd 容器IDvi config.v2.json

下文是nginx配置文件的举例,例如要修conf.d的改挂载地址,搜索MountPoints,在下文中找到
{"StreamConfig": {},"State": {"Running": true,"Paused": false,"Restarting": false,"OOMKilled": false,"RemovalInProgress": false,"Dead": false,"Pid": 8650,"ExitCode": 0,"Error": "","StartedAt": "2022-04-01T07:30:50.731680798Z","FinishedAt": "2022-04-01T07:30:46.907933433Z","Health": null},"ID": "e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3","Created": "2022-03-30T07:12:19.531076176Z","Managed": false,"Path": "/docker-entrypoint.sh","Args": ["nginx","-g","daemon off;"],"Config": {"Hostname": "e892198d4792","Domainname": "","User": "","AttachStdin": false,"AttachStdout": false,"AttachStderr": false,"ExposedPorts": {"80/tcp": {},"9000/tcp": {},"9020/tcp": {}},"Tty": true,"OpenStdin": true,"StdinOnce": false,"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NGINX_VERSION=1.21.6","NJS_VERSION=0.7.2","PKG_RELEASE=1~bullseye"],"Cmd": ["nginx","-g","daemon off;"],"Image": "nginx","Volumes": null,"WorkingDir": "","Entrypoint": ["/docker-entrypoint.sh"],"OnBuild": null,"Labels": {"maintainer": "NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e"},"StopSignal": "SIGQUIT"},"Image": "sha256:12766a6745eea133de9fdcd03ff720fa971fdaf21113d4bc72b417c123b15619","NetworkSettings": {"Bridge": "","SandboxID": "4d373bd98fc8199ba5b692e90b7de2cdd00743864f899064fd09ff51372488a9","HairpinMode": false,"LinkLocalIPv6Address": "","LinkLocalIPv6PrefixLen": 0,"Networks": {"bridge": {"IPAMConfig": null,"Links": null,"Aliases": null,"NetworkID": "f827685fcfd78b2992757fec5352f35ba03ff4a59d440b5285b73a4b5ca95374","EndpointID": "2fd4f3cca1cbafecf4066e07a1377b8c238da5df8cf28080ff07473c1e2e660d","Gateway": "172.18.0.1","IPAddress": "172.18.0.2","IPPrefixLen": 16,"IPv6Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"MacAddress": "02:42:ac:12:00:02","DriverOpts": null,"IPAMOperational": false}},"Service": null,"Ports": {"80/tcp": null,"9000/tcp": [{"HostIp": "0.0.0.0","HostPort": "9000"}],"9020/tcp": [{"HostIp": "0.0.0.0","HostPort": "9020"}]},"SandboxKey": "/var/run/docker/netns/4d373bd98fc8","SecondaryIPAddresses": null,"SecondaryIPv6Addresses": null,"IsAnonymousEndpoint": false,"HasSwarmEndpoint": false},"LogPath": "/var/lib/docker/containers/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3-json.log","Name": "/nginx","Driver": "overlay2","OS": "linux","MountLabel": "","ProcessLabel": "","RestartCount": 0,"HasBeenStartedBefore": true,"HasBeenManuallyStopped": false,"MountPoints": {"/etc/nginx/conf.d": {"Source": "/root/nginx/conf.d","Destination": "/etc/nginx/conf.d","RW": true,"Name": "","Driver": "","Type": "bind","Propagation": "rprivate","Spec": {"Type": "bind","Source": "/root/nginx/conf.d","Target": "/etc/nginx/conf.d"},"SkipMountpointCreation": false},"/etc/nginx/nginx.conf": {"Source": "/root/nginx/nginx.conf","Destination": "/etc/nginx/nginx.conf","RW": true,"Name": "","Driver": "","Type": "bind","Propagation": "rprivate","Spec": {"Type": "bind","Source": "/root/nginx/nginx.conf","Target": "/etc/nginx/nginx.conf"},"SkipMountpointCreation": false},"/usr/local/nginx/9020/dist": {"Source": "/root/nginx/9020/dist","Destination": "/usr/local/nginx/9020/dist","RW": true,"Name": "","Driver": "","Type": "bind","Propagation": "rprivate","Spec": {"Type": "bind","Source": "/root/nginx/9020/dist","Target": "/usr/local/nginx/9020/dist"},"SkipMountpointCreation": false}},"SecretReferences": null,"ConfigReferences": null,"AppArmorProfile": "","HostnamePath": "/var/lib/docker/containers/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3/hostname","HostsPath": "/var/lib/docker/containers/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3/hosts","ShmPath": "/var/lib/docker/containers/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3/mounts/shm","ResolvConfPath": "/var/lib/docker/containers/e892198d4792909c32bf645c78de662d0ed318ff4c14779dfc4cfcedf454add3/resolv.conf","SeccompProfile": "","NoNewPrivileges": false}
