我有phpmyadminDocker 容器运行较旧版本的 phpMyAdmin。我需要将 phpMyAdmin 更新到最新版本。此处的常见解决方案是停止当前容器,然后获取最新的镜像phpMyAdmin然后从中启动一个新容器。
然而这个解决方案,就像它,不适合我,因为我之前修改了当前容器的配置,安装了一些额外的主题等,所以我想在更新后保留(至少)配置,例如网络端口等。
有什么方法可以保留旧容器的配置以便在新的更新容器中使用?
更新
检查的完整输出:
[
{
"Id": "b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841",
"Created": "2021-12-15T21:36:44.645730545Z",
"Path": "/docker-entrypoint.sh",
"Args": [
"apache2-foreground"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2079,
"ExitCode": 0,
"Error": "",
"StartedAt": "2024-01-11T15:47:11.107791099Z",
"FinishedAt": "2024-01-10T21:56:07.409001Z"
},
"Image": "sha256:ccebddf114742e63f84ba9c90afeb75719c3f92c17e30e4a4ad98c8cd1af8aef",
"ResolvConfPath": "/var/lib/docker/containers/b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841/hostname",
"HostsPath": "/var/lib/docker/containers/b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841/hosts",
"LogPath": "/var/lib/docker/containers/b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841/b53734ca90b06ac6b109f91ecedec7c51b32f9dff88822c86a1a8e03e2a49841-json.log",
"Name": "/phpmyadmin",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "foxNet",
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "8888"
}
]
},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
0,
0
],
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": null,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/6d338fbcdf1985b48f584b9868f77f9583bd84baa2fb5ed521b888a2173a7ca9-init/diff:/var/lib/docker/overlay2/85da6fd0d388892dc8aec990fc310255d98b1f61f494a57c082a6e7074f4784d/diff:/var/lib/docker/overlay2/d5f33040e099ec5da595aa94042000c23c12a5c81cc2add7ff1c1e0d495359ee/diff:/var/lib/docker/overlay2/496f7e735af2ecc05491a0f13be63f9c723e950ca103e9b4059bd224dd2fb767/diff:/var/lib/docker/overlay2/689ad3ccfbd7e9f12f8efac651edb546d669ab455822691bfd6e6a3ad6d90bcd/diff:/var/lib/docker/overlay2/a1ca1e7ccd31220558324aa268cdc3104c1220fd6ddfdcedb6e43642411a1f38/diff:/var/lib/docker/overlay2/ae2c9d26dc4a0e4d15e0f5dd26314d9bf4c7ee565a09cd5cdd383acf347fb436/diff:/var/lib/docker/overlay2/13acc7001aabc2db85644e7b9fae1d5a8bfe0e8fed6adccf032d28ddf0922366/diff:/var/lib/docker/overlay2/6ad01c4feb1a6fd1ad87d776c93c2db27eb83cba79fefe8bd37ea7ae87c06efe/diff:/var/lib/docker/overlay2/055801826e3e95f2b778eccad7b23b8c97191279201fcf90649c087a60555939/diff:/var/lib/docker/overlay2/80a97f0a5257be077dd931aca1e3a426b984794a7f019e9bdbc05608bb7a3c28/diff:/var/lib/docker/overlay2/228511c37bfd270d481c887dcd833059088bbc8df62104cd2b9e89ae9e2e6573/diff:/var/lib/docker/overlay2/c67aa89ecac044e327d7c944008e57357cfcd89150897e8cbb5b799df01484e5/diff:/var/lib/docker/overlay2/5eb0ac794ad6a64fff53a015e0a8402f048b13c1ace30b7f8433aba683578229/diff:/var/lib/docker/overlay2/c7220562a5b72365b3ebabf212e12d2a13cc205caf799bb250718e507572e68a/diff:/var/lib/docker/overlay2/69a5b0c6473beeea7bbef1463720a189528fc720b18746c0445d7c392bb4eec9/diff:/var/lib/docker/overlay2/704d94421af179cbee366b267720d9292949e8b5a469e8d58e47cead5637f368/diff:/var/lib/docker/overlay2/5f0c83690a6548b850f049dd9ade4d77a5257273bc6e2dd8cb226db2405ecd92/diff:/var/lib/docker/overlay2/66785b710f9eb42218a8432db318d3d5118904dcc8a56763dc9eeca9bb90d66f/diff",
"MergedDir": "/var/lib/docker/overlay2/6d338fbcdf1985b48f584b9868f77f9583bd84baa2fb5ed521b888a2173a7ca9/merged",
"UpperDir": "/var/lib/docker/overlay2/6d338fbcdf1985b48f584b9868f77f9583bd84baa2fb5ed521b888a2173a7ca9/diff",
"WorkDir": "/var/lib/docker/overlay2/6d338fbcdf1985b48f584b9868f77f9583bd84baa2fb5ed521b888a2173a7ca9/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "b53734ca90b0",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
"PHP_INI_DIR=/usr/local/etc/php",
"APACHE_CONFDIR=/etc/apache2",
"APACHE_ENVVARS=/etc/apache2/envvars",
"PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_LDFLAGS=-Wl,-O1 -pie",
"GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312",
"PHP_VERSION=7.4.26",
"PHP_URL=https://www.php.net/distributions/php-7.4.26.tar.xz",
"PHP_ASC_URL=https://www.php.net/distributions/php-7.4.26.tar.xz.asc",
"PHP_SHA256=e305b3aafdc85fa73a81c53d3ce30578bc94d1633ec376add193a1e85e0f0ef8",
"MAX_EXECUTION_TIME=600",
"MEMORY_LIMIT=512M",
"UPLOAD_LIMIT=2048K",
"VERSION=5.1.1",
"SHA256=1964d7190223c11e89fa1b7970c618e3a3bae2e859f5f60383f64c3848ef6921",
"URL=https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.tar.xz"
],
"Cmd": [
"apache2-foreground"
],
"Image": "phpmyadmin",
"Volumes": null,
"WorkingDir": "/var/www/html",
"Entrypoint": [
"/docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"org.opencontainers.image.authors": "The phpMyAdmin Team <[email protected]>",
"org.opencontainers.image.description": "Run phpMyAdmin with Alpine, Apache and PHP FPM.",
"org.opencontainers.image.documentation": "https://github.com/phpmyadmin/docker#readme",
"org.opencontainers.image.licenses": "GPL-2.0-only",
"org.opencontainers.image.source": "https://github.com/phpmyadmin/docker.git",
"org.opencontainers.image.title": "Official phpMyAdmin Docker image",
"org.opencontainers.image.url": "https://github.com/phpmyadmin/docker#readme",
"org.opencontainers.image.vendor": "phpMyAdmin",
"org.opencontainers.image.version": "5.1.1"
},
"StopSignal": "SIGWINCH"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "d7f131eb72abe84e8bdac15be4180406e6c6c7c247b90b74343cf21a56d2c6d3",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8888"
},
{
"HostIp": "::",
"HostPort": "8888"
}
]
},
"SandboxKey": "/var/run/docker/netns/d7f131eb72ab",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"foxNet": {
"IPAMConfig": null,
"Links": [
"mysql:db"
],
"Aliases": [
"b53734ca90b0"
],
"NetworkID": "1e3427aacb8ffb79404adfecfc63a51e6da994bc3ff9988a4c66bcf647f82e63",
"EndpointID": "dcd0476d65f4e6899d782d7e462e6d68a894237dba94b25b5b28ef04cc653906",
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:13:00:02",
"DriverOpts": null
}
}
}
}
]