Why I don't see Tomcat after run docker tomcat? - docker

I am quite new with Docker. I follow this tutorial: https://stackjava.com/docker/huong-dan-cai-apache-tomcat-bang-docker-sua-port-username-password.html
My command
docker pull tomcat
docker run -it tomcat
docker ps -a
docker inspect -f '{{json .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 5e55df1c76bb
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 5e55df1c76bb
docker inspect 5e55df1c76bb
docker inspect --format="{{json .NetworkSettings.Networks}}" 5e55df1c76bb
172.17.0.2
but I access: http://172.17.0.2:8080 see nothing
C:\Users\donhuvy>docker inspect 5e55df1c76bb
[
{
"Id": "5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229",
"Created": "2020-10-05T16:02:40.7573065Z",
"Path": "catalina.sh",
"Args": [
"run"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 987,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-10-05T16:02:41.1437801Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:f796d3d2c1954864eae249749f0a17480fb446c22053f4451e2c3514c561638b",
"ResolvConfPath": "/var/lib/docker/containers/5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229/hostname",
"HostsPath": "/var/lib/docker/containers/5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229/hosts",
"LogPath": "/var/lib/docker/containers/5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229/5e55df1c76bb8dff9e423b7750b62594e150bb2468b033acad18ea9f7d445229-json.log",
"Name": "/recursing_mirzakhani",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"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",
"ConsoleSize": [
29,
125
],
"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,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"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/73d16111a45bdfadbd3504d2ce0c252f2fd5f03d7a7f1340b35f68179d06ff52-init/diff:/var/lib/docker/overlay2/4f4ba32e9f0e1ab529e63310679569d7dcc1e661711b9ee4318e2ee65891f994/diff:/var/lib/docker/overlay2/fce4dda91aa387a1637fcac186996c18e34f8972cc7556023a84ceed8f9547c6/diff:/var/lib/docker/overlay2/f57b2ab773944fe913da9c109de5d74d21f79c5f6b00e9362247916de89a480b/diff:/var/lib/docker/overlay2/1fb80e26e111dac4d0afd9cd069da39b0e4d6005f649fefc9f62786d644ef10c/diff:/var/lib/docker/overlay2/71d4caaff5263b8a146f8e512cdc94ddd5a64d0ce06aefd2806b17ba7b2bb1e1/diff:/var/lib/docker/overlay2/94bbeff68944707d4ec182874b3054e241f87f184cc73370fd2a4872cc7ee4f5/diff:/var/lib/docker/overlay2/ff0f6369023d7c463b55141759b930eadbeacb60dcb2f64b27bef652dffb754c/diff:/var/lib/docker/overlay2/0d067db196d1894c9685f3bd71d2f5ee6e321784de6ec2ccd8f2ce0744042083/diff:/var/lib/docker/overlay2/f9bd339ee715bbed03a969664abfe5aa89f39c22cb42a69d89a9a989edd17257/diff:/var/lib/docker/overlay2/a92a068cbd132637742e14d1df96c081342ba8ab10663ef87197058b39e618e5/diff",
"MergedDir": "/var/lib/docker/overlay2/73d16111a45bdfadbd3504d2ce0c252f2fd5f03d7a7f1340b35f68179d06ff52/merged",
"UpperDir": "/var/lib/docker/overlay2/73d16111a45bdfadbd3504d2ce0c252f2fd5f03d7a7f1340b35f68179d06ff52/diff",
"WorkDir": "/var/lib/docker/overlay2/73d16111a45bdfadbd3504d2ce0c252f2fd5f03d7a7f1340b35f68179d06ff52/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "5e55df1c76bb",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"8080/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/usr/local/tomcat/bin:/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/local/openjdk-11",
"JAVA_VERSION=11.0.8",
"CATALINA_HOME=/usr/local/tomcat",
"TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib",
"LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib",
"GPG_KEYS=05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23",
"TOMCAT_MAJOR=9",
"TOMCAT_VERSION=9.0.38",
"TOMCAT_SHA512=37117164c9ab985b4f3032deac9617cee01463f8822586a62a9c498d2720fac23a8207fcf7a76cea2fcb3c6f828ff12b7b31422316a7d92e707c3bd8d687e303"
],
"Cmd": [
"catalina.sh",
"run"
],
"Image": "tomcat",
"Volumes": null,
"WorkingDir": "/usr/local/tomcat",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "c2b2e13e21b94eb338ce47eb6f7319f719bd1d617fef7535d81f10210408be2a",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8080/tcp": null
},
"SandboxKey": "/var/run/docker/netns/c2b2e13e21b9",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "f9582dfa8c2818b7f9846bf45fe3b56e671ca89efd2adab77c512d958beede7d",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "85106b65ae7140fb90ba8edcb0247f2fcf904f84cd540e6689613b5615b95bb5",
"EndpointID": "f9582dfa8c2818b7f9846bf45fe3b56e671ca89efd2adab77c512d958beede7d",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
C:\Users\donhuvy>
How to see the result of Tomcat on web browser?

I think the tutorial you are referring to is a bit outdated. You can run the tomcat docker container using a command like
docker run --rm --name tomcat-server -p 8080:8080 tomcat:latest
Access tomcat at http://localhost:8080
Further information is here. You would initially get a 404 as the webapp folder is empty. You can refer to this documentation which should help in getting a basic Tomcat installation running. You can then follow from step 3 of the original tutorial you are refer to.
docker exec -it tomcat-server /bin/bash
mv webapps webapps2
mv webapps.dist/ webapps
exit

Related

Docker destination directory stays empty

Today I installed home assistant as docker on my banana pi but the config files are not showing up in the destination directory I am giving him as argument. The command was:
docker run -d --name="homeass" --privileged --restart=unless-stopped -e "TZ=Europe/Berlin" -v /home/pi/homeassistant/config --net=host homeassistant/home-assistant:stable
the directories homeassistant and config where create before and the container is starting without problems in the logs but I cant find the config files like configuration.yaml which should be saved in "/home/pi/homeassistant/config".
Does anyone have an idea what I have to change in the command? Its no problem to create a new image since I havent done much in this one for now.
if I executed docker container inspect homeass I can see that the output direcoty is actually set also in the config file of the docker:
[
{
"Id": "9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147",
"Created": "2023-02-03T11:21:00.96540989Z",
"Path": "/init",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2805,
"ExitCode": 0,
"Error": "",
"StartedAt": "2023-02-03T11:39:06.972601472Z",
"FinishedAt": "2023-02-03T11:35:00.448917386Z"
},
"Image": "sha256:a44a85612bd638627325945d65ce4b7986388ea3726b5a4a211fe0a14a251d3d",
"ResolvConfPath": "/var/lib/docker/containers/9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147/hostname",
"HostsPath": "/var/lib/docker/containers/9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147/hosts",
"LogPath": "/var/lib/docker/containers/9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147/9094e7a06d234f41a9cdc17010913e9e87bce3eefdab8c14e13f6ed44c410147-json.log",
"Name": "/homeass",
"RestartCount": 0,
"Driver": "aufs",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "host",
"PortBindings": {},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": true,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": [
"label=disable"
],
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"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,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": null,
"ReadonlyPaths": null
},
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"Mounts": [
{
"Type": "volume",
"Name": "f9496784c586883e1ca42736698675a224f3d11d3f4447ed5c9e0cad83c2e2cf",
"Source": "/var/lib/docker/volumes/f9496784c586883e1ca42736698675a224f3d11d3f4447ed5c9e0cad83c2e2cf/_data",
"Destination": "/home/pi/homeassistant/config",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "bpi-fabio",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"TZ=Europe/Berlin",
"PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"S6_BEHAVIOUR_IF_STAGE2_FAILS=2",
"S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0",
"S6_CMD_WAIT_FOR_SERVICES=1",
"S6_SERVICES_READYTIME=50",
"WHEELS_LINKS=https://wheels.home-assistant.io/musllinux/",
"S6_SERVICES_GRACETIME=220000"
],
"Cmd": null,
"Image": "homeassistant/home-assistant:stable",
"Volumes": {
"/home/pi/homeassistant/config": {}
},
"WorkingDir": "/config",
"Entrypoint": [
"/init"
],
"OnBuild": null,
"Labels": {
"io.hass.arch": "armv7",
"io.hass.base.arch": "armv7",
"io.hass.base.image": "homeassistant/armv7-base:3.16",
"io.hass.base.name": "python",
"io.hass.base.version": "2022.11.0",
"io.hass.type": "core",
"io.hass.version": "2023.2.0",
"org.opencontainers.image.authors": "The Home Assistant Authors",
"org.opencontainers.image.created": "2023-02-01 18:44:18+00:00",
"org.opencontainers.image.description": "Open-source home automation platform running on Python 3",
"org.opencontainers.image.documentation": "https://www.home-assistant.io/docs/",
"org.opencontainers.image.licenses": "Apache License 2.0",
"org.opencontainers.image.source": "https://github.com/home-assistant/core",
"org.opencontainers.image.title": "Home Assistant",
"org.opencontainers.image.url": "https://www.home-assistant.io/",
"org.opencontainers.image.version": "2023.2.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "420efbec5a07cdd4539104cd2d089d2178b038fcc611208e3b703fff0665f617",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/default",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"host": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "dd4b1bf855731d67ea2eaa579f723411662ae309860995d35bf19a7e0971f74a",
"EndpointID": "9efaa9624d61d6b1b7c27b244e683124669c9082c9180fe2a239fc95c837fa91",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]
You missed a : when copying the docker setup command from the installation instructions. Try:
docker run -d --name="homeass" --privileged --restart=unless-stopped -e "TZ=Europe/Berlin" -v /home/pi/homeassistant:/config --net=host homeassistant/home-assistant:stable
That should put the files in /home/pi/homeassistant.
If you do want the files to end up in /home/pi/homeassistant/config,
write -v /home/pi/homeassistant/config:/config.

Can't connect to redis which is running in docker

Docker was updated and asked me about factory reset because some files were corrupted. Ok, I did it. Now I can't connect to redis, but it worked before.
I use docker run -p 6379:6379 -d redis for running the latest redis.
I check it (printf "PING\r\n";) | nc localhost 6379 but nothing happen.
Docker version 20.10.5, build 55c4c88.
MacOS 11.2.3 (20D91)
Looks like a network issue with resolving from localhost to docker.
❯ docker inspect 6377a770196e
[
{
"Id": "6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f",
"Created": "2021-04-13T11:16:11.029910005Z",
"Path": "docker-entrypoint.sh",
"Args": [
"redis-server"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 3981,
"ExitCode": 0,
"Error": "",
"StartedAt": "2021-04-13T11:16:12.472660785Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:de974760ddb2f32dbddb74b7bb8cff4c1eee06d43d36d11bbca1dc815173916e",
"ResolvConfPath": "/var/lib/docker/containers/6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f/hostname",
"HostsPath": "/var/lib/docker/containers/6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f/hosts",
"LogPath": "/var/lib/docker/containers/6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f/6377a770196edf1a804d482a89deda2e046817ecb827c2a1afa00b7920f9952f-json.log",
"Name": "/blissful_galois",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"6379/tcp": [
{
"HostIp": "",
"HostPort": "6379"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"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",
"ConsoleSize": [
0,
0
],
"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,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"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/3ea4acf29016fed55d4a2c29f109de3013e432a9b3f02e4fdc084d92750fa03a-init/diff:/var/lib/docker/overlay2/8ff9465854165041a94e97a4f10f56c96a9589b2bf6181f12c1d3797195e141d/diff:/var/lib/docker/overlay2/9bf938f8abdddd10c9a45b033e113e9981df4292d0a07f5eb1df56bc93e1a19e/diff:/var/lib/docker/overlay2/ab76326e67b49b0b5e89ba83f33ae9787aa4b75ec7497f08825d643e1f87dd02/diff:/var/lib/docker/overlay2/7baa2201e34a35ab376faa44542ec94b656bede1134c2f9b3761b7aefe4bfdff/diff:/var/lib/docker/overlay2/b7379d15235571165f01eae5d5136e04778421703e30e2ee5cdd0fe63c5e9d8d/diff:/var/lib/docker/overlay2/244fff080dbb5c84c603ee4a212686ab44b5c528ef117a92e55697c54d9d2edc/diff",
"MergedDir": "/var/lib/docker/overlay2/3ea4acf29016fed55d4a2c29f109de3013e432a9b3f02e4fdc084d92750fa03a/merged",
"UpperDir": "/var/lib/docker/overlay2/3ea4acf29016fed55d4a2c29f109de3013e432a9b3f02e4fdc084d92750fa03a/diff",
"WorkDir": "/var/lib/docker/overlay2/3ea4acf29016fed55d4a2c29f109de3013e432a9b3f02e4fdc084d92750fa03a/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "057a2307c4c2045ac412e59dda40201a9062c08115d4b67102afe3a05a5c1528",
"Source": "/var/lib/docker/volumes/057a2307c4c2045ac412e59dda40201a9062c08115d4b67102afe3a05a5c1528/_data",
"Destination": "/data",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "6377a770196e",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"6379/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.12",
"REDIS_VERSION=6.2.1",
"REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-6.2.1.tar.gz",
"REDIS_DOWNLOAD_SHA=cd222505012cce20b25682fca931ec93bd21ae92cb4abfe742cf7b76aa907520"
],
"Cmd": [
"redis-server"
],
"Image": "redis",
"Volumes": {
"/data": {}
},
"WorkingDir": "/data",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "23d13da3b9d547635ca0519e5d2a358b46a3dd8234925d07a6dc0725b2a3eb4b",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"6379/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "6379"
}
]
},
"SandboxKey": "/var/run/docker/netns/23d13da3b9d5",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "3ce444ad8732cfbdb1cf59e90835a82b4ee2c5d56ec423ff5bdbce9b22836256",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "14088994d7e24bf472756c9b9204611d0698d29f7c9c34a79fa99788eac39b7c",
"EndpointID": "3ce444ad8732cfbdb1cf59e90835a82b4ee2c5d56ec423ff5bdbce9b22836256",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]

Not able to run docker using IP address

I ran a Docker image. Both the container and host ports are mapped to 5000, and it can be accessed using localhost but not with the IP address. I don't have any knowledge on network systems and I'm a beginner in Docker.
I'm using Docker app for Windows, and upon docker inspect, I got this JSON:
[
{
"Id": "c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7",
"Created": "2020-08-19T18:17:50.917578Z",
"Path": "java",
"Args": [
"-jar",
"/app.jar"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 3142,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-08-19T18:17:53.0308405Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:04d86c26964a44e147a0132bc6f6810f5aeba005d655b0d0b86f04499fc6a7a1",
"ResolvConfPath": "/var/lib/docker/containers/c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7/hostname",
"HostsPath": "/var/lib/docker/containers/c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7/hosts",
"LogPath": "/var/lib/docker/containers/c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7/c38f489d712502ce57e5f6b86d8ad1efd3cf64d3c60ab3239bf34a727d0155b7-json.log",
"Name": "/blissful_noether",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"5000/tcp": [
{
"HostIp": "",
"HostPort": "5000"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
44,
168
],
"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,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/49e30cda4983fa70169660522eb0264adb6a86ba7714f051ceb7fe9ba2e6f921-init/diff:/var/lib/docker/overlay2/52cc6d89b46870d8613801fc85cb6f9fa38c0b37b07857de839acd4d001b5530/diff:/var/lib/docker/overlay2/e058a1965c0dff7fbaf1f2fbbe9dbbd491f273d3389c093a3aff1a2c928e305e/diff:/var/lib/docker/overlay2/ea09144ed7206c329c5dac727f9ddd3f346260a59b9e595916f17ee11c3b6d97/diff:/var/lib/docker/overlay2/53820238bb96c5ce804cc77ecbad212bcd3bf6d6a1ca5fdcc3f4d6f4e2349007/diff",
"MergedDir": "/var/lib/docker/overlay2/49e30cda4983fa70169660522eb0264adb6a86ba7714f051ceb7fe9ba2e6f921/merged",
"UpperDir": "/var/lib/docker/overlay2/49e30cda4983fa70169660522eb0264adb6a86ba7714f051ceb7fe9ba2e6f921/diff",
"WorkDir": "/var/lib/docker/overlay2/49e30cda4983fa70169660522eb0264adb6a86ba7714f051ceb7fe9ba2e6f921/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "df1fe5e69c6437bd3e43d737b5cf7b37f9c1c5325b5505964579fd093ed4beae",
"Source": "/var/lib/docker/volumes/df1fe5e69c6437bd3e43d737b5cf7b37f9c1c5325b5505964579fd093ed4beae/_data",
"Destination": "/tmp",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "c38f489d7125",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk",
"JAVA_VERSION=8u212",
"JAVA_ALPINE_VERSION=8.212.04-r0"
],
"Cmd": null,
"ArgsEscaped": true,
"Image": "04d86c26964a",
"Volumes": {
"/tmp": {}
},
"WorkingDir": "",
"Entrypoint": [
"java",
"-jar",
"/app.jar"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "fb790b4e2c72fc9b2c9641e1eb91aca5e74759b2ee0265ce5a1907ddb3eb1865",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"5000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "5000"
}
]
},
"SandboxKey": "/var/run/docker/netns/fb790b4e2c72",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "0f084ea8ca77ec70d850291644523b81597b761dabe687b4e0035b4ae2e3dd56",
"Gateway": "xxx.xx.x.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "xxx.xx.x.x",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:bc:19:10:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "51b3be5f2161bb70042d5efd31f5b611cea241248a142f46fa612352c",
"EndpointID": "0f084ea8ca77ec70d850291644523b81597b761dabe687b45b4ae2e3dd56",
"Gateway": "xxx.xx.x.1",
"IPAddress": "xxx.xx.x.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:bc:11:00:02",
"DriverOpts": null
}
}
}
}
]
[![ipconfig][1]][1]
I even just came to know that even a Docker container consists of IP. Why is it so? Can anyone help me understand how the container can be accessed with IP?
I have tried with all the IPs available in the JSON above and ipconfig image, but it does not work.
Yes, Docker containers have their Unique IP address(more in Kubernetes).
https://stackoverflow.com/a/43694284/9650284
refer this for an explanation(comments on the solutions). TLDR it is not possible to access the internal IP of the docker container from your host.

docker network use host mode not working(no port expose)

This is my information:
➜ ~ docker -v
Docker version 19.03.5, build 633a0ea
➜ ~ uname -ar
Darwin Felixs-iMac.local 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64
when I create a docker with host network mode like this (which is copied from https://docs.docker.com/network/network-tutorial-host/)
docker run --rm -d --network host --name my_nginx nginx
It worked well and I can see the docker is running.
BUT THE PROBLEM IS the port isn't exposed.
when i check with lsof -i:80, there's nothing.
➜ ~ docker run --rm -d --network host --name my_nginx nginx
282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d
➜ ~ lsof -i:80
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
282fe15a16b7 nginx "nginx -g 'daemon of…" About a minute ago Up About a minute
And i inspected the container, everything seems good:
➜ ~ docker inspect my_nginx
[
{
"Id": "282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d",
"Created": "2020-02-26T15:35:58.243963941Z",
"Path": "nginx",
"Args": [
"-g",
"daemon off;"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2238,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-02-26T15:35:58.39452216Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:2073e0bcb60ee98548d313ead5eacbfe16d9054f8800a32bedd859922a99a6e1",
"ResolvConfPath": "/var/lib/docker/containers/282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d/hostname",
"HostsPath": "/var/lib/docker/containers/282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d/hosts",
"LogPath": "/var/lib/docker/containers/282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d/282fe15a16b70d7bd38b770fd2b67f0023b8fce1f9852a91af4047ef8f6a3f0d-json.log",
"Name": "/my_nginx",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "host",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": true,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"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",
"ConsoleSize": [
0,
0
],
"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,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"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/062cb6ccb41fb22ba624fb8f93e99e79bcf02cd240fbb4998e47aab1380e015f-init/diff:/var/lib/docker/overlay2/587f9f458f8f0de65434971354636364ff685701fa1f8ba0ba7da4459e22540c/diff:/var/lib/docker/overlay2/1a94586d0949b8305ac14f0934a46149b31db3eb6e7125d7b2965deef318695d/diff:/var/lib/docker/overlay2/ac900d4637ed15f3337e999928ec2a9de2ef4a998f4ce53700a1dffc955d5f0e/diff",
"MergedDir": "/var/lib/docker/overlay2/062cb6ccb41fb22ba624fb8f93e99e79bcf02cd240fbb4998e47aab1380e015f/merged",
"UpperDir": "/var/lib/docker/overlay2/062cb6ccb41fb22ba624fb8f93e99e79bcf02cd240fbb4998e47aab1380e015f/diff",
"WorkDir": "/var/lib/docker/overlay2/062cb6ccb41fb22ba624fb8f93e99e79bcf02cd240fbb4998e47aab1380e015f/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "docker-desktop",
"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",
"NGINX_VERSION=1.17.8",
"NJS_VERSION=0.3.8",
"PKG_RELEASE=1~buster"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"Image": "nginx",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint#nginx.com>"
},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "be4dc476e331bb8ac857ec069d0aa8383d7700ba5b917c0fed44c59d0b042c99",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/default",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"host": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "56456bd40ca98647fed01509408599accfadc7cb0f0077ea884b18fc009801b5",
"EndpointID": "e3e870245e2995fbfbae8706fa2daa19f3bf3d59d11d2f8ce2300f2b84b211e0",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]
Anybody can help me ?
If you're using MacOS, then host network mode will not work on it, the reason for that is that docker-desktop uses an underlying Linux Virtual Machine to run the docker containers, so this host mode is only valid for that VM's network and not for the host(MacOS machine).
Still if you want to access a service running on your host machine(MacOS), from your docker container then you need to use the following hostname in order to connect to that service:
host.docker.internal
You'll be using the above hostname in place of localhost or 127.0.0.1.
For further discussion regarding this you check this github issue

Unable to see the containers in Docker Toolsbox

I have installed docker toolsbox in windows 10.
I have created a container for mysql for the an application using the docker command as given. I'm able to create it and also able to view it using the docker container ls command, but only for the first time.
The Problem occurs when closing the docker toolsbox and reopen it.
When I issued the docker container ls command, I'm unable to find any of the containers what I have created.
But When I tried to inspect the container I'm able to view the container details.
Attached the screenshot and json details of the container.
Please let me know in case of more information needed.
Docker command for creating the MySQL container
docker run --name mysql-docker-petclinic -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=petclinic -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=admin -p 3306:3306 -d mysql:latest
Inspect Command Details
$ docker container inspect mysql-docker-petclinic
[
{
"Id": "f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0",
"Created": "2018-02-25T16:28:10.327158448Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 255,
"Error": "",
"StartedAt": "2018-02-25T16:28:12.428822667Z",
"FinishedAt": "2018-02-26T04:38:54.98958199Z"
},
"Image": "sha256:f0f3956a9dd825e3195f0d1a4fe17cc94b0f6934fc470b09abf8fad87d17ff24",
"ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/resolv.conf",
"HostnamePath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/hostname",
"HostsPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/hosts",
"LogPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0-json.log",
"Name": "/mysql-docker-petclinic",
"RestartCount": 0,
"Driver": "aufs",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "",
"HostPort": "3306"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
30,
120
],
"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,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0
},
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"Mounts": [
{
"Type": "volume",
"Name": "7195ae34c4698fbcdf3737962e799e991e0268a33ea6126af8b0e4aa24b2b18e",
"Source": "/mnt/sda1/var/lib/docker/volumes/7195ae34c4698fbcdf3737962e799e991e0268a33ea6126af8b0e4aa24b2b18e/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "f30f66154b73",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_ROOT_PASSWORD=admin",
"MYSQL_DATABASE=petclinic",
"MYSQL_USERNAME=root",
"MYSQL_PASSWORD=admin",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.7",
"MYSQL_MAJOR=5.7",
"MYSQL_VERSION=5.7.21-1debian8"
],
"Cmd": [
"mysqld"
],
"ArgsEscaped": true,
"Image": "mysql:latest",
"Volumes": {
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "0f9a23a942344c2e7c23d425456787db327278dec4601447eb526dfdaa9c3abb",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3306"
}
]
},
"SandboxKey": "/var/run/docker/netns/0f9a23a94234",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "*********************************************************",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "*********************************",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "*********************************************************",
"EndpointID": "*********************************************************",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "*********************************************************",
"DriverOpts": null
}
}
}
}
]
Screenshots
1. Docker ls command
2. Docker Inspect Command Details
------------- UPDATE -------------
docker container ls by default shows only the running container.
closing the docker toolsbox and reopen it
That means all your containers are now in "Exited" state.
Try:
docker container ls --all
See also docker ps -a

Resources