У меня есть приложение реактивной сети netl-boot 2.2.0.RELEASE, которое вызывает внешний URL-адрес. java -jar -Xms128m -Xmx128m -XX: + UseG1GC -Dapp.logger.level = debug -Dspring.profiles.active = prod -Dapp.postcode.masked = true -Dapp.refresh.rate = 5 app.jar прекрасно работает на локальной машине с Ubuntu. Я создаю Dockerfile, как показано:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY app.jar app.jar
CMD ["java","-Xms128m","-Xmx128m","-XX:+UseG1GC","-Djava.security.egd=file:/dev/./urandom","-Dapp.logger.level=debug","-Dspring.profiles.active=prod","-Dapp.postcode.masked=true","-Dapp.refresh.rate=5","-jar","/app.jar"]
Но при запуске Docker-контейнера приложение останавливается в том месте, где мы ожидаем увидеть логотип Spring-boot, и внешний URL-адрес не вызывается.
Docker Inspect my-container-id Вывод команды выглядит следующим образом:
[
{
"Id": "ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea",
"Created": "2019-11-09T14:20:15.954119877Z",
"Path": "java",
"Args": [
"-Xms128m",
"-Xmx128m",
"-XX:+UseG1GC",
"-Djava.security.egd=file:/dev/./urandom",
"-Dapp.logger.level=debug",
"-Dspring.profiles.active=prod",
"-Dapp.postcode.masked=true",
"-Dapp.refresh.rate=5",
"-jar",
"/app.jar"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 1486,
"ExitCode": 0,
"Error": "",
"StartedAt": "2019-11-09T14:20:17.182186765Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:c857deea61b61b1e0783349a72fa23120fa8be9441347e92682cb7167bdc1eb6",
"ResolvConfPath": "/var/lib/docker/containers/ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea/hostname",
"HostsPath": "/var/lib/docker/containers/ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea/hosts",
"LogPath": "/var/lib/docker/containers/ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea/ea077c80e45eda3443d6a55dba9f09bdd10623caa43caa30f5e20b02dde6deea-json.log",
"Name": "/romantic_euler",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"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,
"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": [
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,
"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/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/4b8c8619145a0c996efe95e2f1de24aaaf92f18fa6565048324081f10a1e7554-init/diff:/var/lib/docker/overlay2/d971ed3a77711e6931f427cd65bd062db4d6557ea1ba96ac6d082375c40c686d/diff:/var/lib/docker/overlay2/d89c12322ad67081600fcfdd6883bbb976ad9a7cb2b5bd38e44efef8dea8db2f/diff:/var/lib/docker/overlay2/663378a32701bfaeafa440dba0083d6d2bd9b44762c2dab496b6b0299a3f70b2/diff:/var/lib/docker/overlay2/c60ec1239620758a13d72fbedac84872b413eea5a3055d29c63b30174776ac31/diff",
"MergedDir": "/var/lib/docker/overlay2/4b8c8619145a0c996efe95e2f1de24aaaf92f18fa6565048324081f10a1e7554/merged",
"UpperDir": "/var/lib/docker/overlay2/4b8c8619145a0c996efe95e2f1de24aaaf92f18fa6565048324081f10a1e7554/diff",
"WorkDir": "/var/lib/docker/overlay2/4b8c8619145a0c996efe95e2f1de24aaaf92f18fa6565048324081f10a1e7554/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "371e94dcfd7a6c78ddf5a0881c1ba55de815c0aa28d0d7dd1667f494112a78d1",
"Source": "/var/lib/docker/volumes/371e94dcfd7a6c78ddf5a0881c1ba55de815c0aa28d0d7dd1667f494112a78d1/_data",
"Destination": "/tmp",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "ea077c80e45e",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"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": "lbc/app:1.0.1",
"Volumes": {
"/tmp": {}
},
"WorkingDir": "",
"Entrypoint": [
"java",
"-Xms128m",
"-Xmx128m",
"-XX:+UseG1GC",
"-Djava.security.egd=file:/dev/./urandom",
"-Dapp.logger.level=debug",
"-Dspring.profiles.active=prod",
"-Dapp.postcode.masked=true",
"-Dapp.refresh.rate=5",
"-jar",
"/app.jar"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "fc3812e69c6e3d126e7430884088fc5221060a60191b9a8e64ce01d036ac8422",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/fc3812e69c6e",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "fb23225e7424faa61e963d60c094c6554f2eb8a1b09671073a8ecdc847b921b8",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:03",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "f80c3cf8c705ee1a1827a0a31f4c96a3ddb2c8e169a696954afeb4bf99f5273c",
"EndpointID": "fb23225e7424faa61e963d60c094c6554f2eb8a1b09671073a8ecdc847b921b8",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:03",
"DriverOpts": null
}
}
}
}
]
Журнал Docker-контейнера выглядит следующим образом:
{"log":"15:10:27,805 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022802761Z"}
{"log":"15:10:27,806 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022885919Z"}
{"log":"15:10:27,807 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/bike-client.jar!/BOOT-INF/classes!/logback.xml]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022899799Z"}
{"log":"15:10:27,842 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@504bae78 - URL [jar:file:/bike-client.jar!/BOOT-INF/classes!/logback.xml] is not of type file\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022909859Z"}
{"log":"15:10:27,988 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022920574Z"}
{"log":"15:10:28,003 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:95 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022929898Z"}
{"log":"15:10:28,003 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022939844Z"}
{"log":"15:10:28,025 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [jsonConsoleAppender]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022949446Z"}
{"log":"15:10:28,124 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventJsonProviders] for [providers] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022958682Z"}
{"log":"15:10:28,285 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventFormattedTimestampJsonProvider] for [timestamp] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022968453Z"}
{"log":"15:10:28,296 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.MessageJsonProvider] for [message] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022978043Z"}
{"log":"15:10:28,300 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggerNameJsonProvider] for [loggerName] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022987985Z"}
{"log":"15:10:28,303 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThreadNameJsonProvider] for [threadName] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.022999791Z"}
{"log":"15:10:28,304 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.ContextJsonProvider] for [context] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023009979Z"}
{"log":"15:10:28,308 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventPatternJsonProvider] for [pattern] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023019372Z"}
{"log":"15:10:28,328 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackTraceJsonProvider] for [stackTrace] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023028962Z"}
{"log":"15:10:28,331 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThrowableClassNameJsonProvider] for [throwableClassName] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.02303855Z"}
{"log":"15:10:28,332 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThrowableRootCauseClassNameJsonProvider] for [throwableRootCauseClassName] property\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023057688Z"}
{"log":"15:10:29,014 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023068665Z"}
{"log":"15:10:29,015 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [jsonConsoleAppender] to Logger[ROOT]\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023077791Z"}
{"log":"15:10:29,015 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.\r\n","stream":"stdout","time":"2019-11-09T15:10:29.023086989Z"}
{"log":"15:10:29,017 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@3b764bce - Registering current configuration as safe fallback point\r\n","stream":"stdout","time":"2019-11-09T15:10:29.02309604Z"}
{"log":"\r\n","stream":"stdout","time":"2019-11-09T15:10:29.024062248Z"}
Я пыталсяс ENTRYPOINT в Dockerfile, но с небольшим успехом. Где бы я ошибся?