Я разрабатываю небольшое приложение Java, которое должно проверять почтовый ящик. Когда я развертываю его в своей производственной среде и выполняю jar, соединение с почтовым ящиком устанавливается через порт 110.
Проблема:
Я помещаю jar в собственном контейнере Docker вместо этого используется порт 995 (защищенное соединение), при этом соединение не устанавливается. Используемый порт определен в файле свойств, включенном в jar, и нигде в моем проекте не упоминается порт 995.
Есть ли параметр Docker, вызывающий такое поведение?
Вот используемый Dockerfile:
FROM openjdk:8
RUN mkdir /webapps
COPY ./mailer_skeleton-1.0.0.jar /webapps/
CMD ["java", "-Dspring.profiles.active=prod", "-jar", "/webapps/mailer_skeleton-1.0.0.jar"]
Вот результат команды docker inspect mailer:
[
{
"Id": "ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b",
"Created": "2020-08-06T07:31:55.607821298Z",
"Path": "java",
"Args": [
"-Dspring.profiles.active=prod",
"-jar",
"/webapps/mailer-1.0.0.jar"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 32587,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-08-06T07:31:56.691286841Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:10ee3c91bcdac8c6194333acc882237bb2a1d06d82143aa024db1ecb8ac1012c",
"ResolvConfPath": "/data/docker/containers/ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b/resolv.conf",
"HostnamePath": "/data/docker/containers/ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b/hostname",
"HostsPath": "/data/docker/containers/ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b/hosts",
"LogPath": "/data/docker/containers/ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b/ceb08f179073aebd8ce4d9731b5c038d4350c064d7367f553ab264dcb632b68b-json.log",
"Name": "/mailer",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/user4docker/ftthapp/mailer/webapps:/usr/local/tomcat/webapps:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "ftthapp_mynet",
"PortBindings": {
"8080/tcp": [
{
"HostIp": "",
"HostPort": "8086"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": [],
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"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": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"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": "/data/docker/overlay2/f2c43a10d3bcab1f5f190cab08cd201c7b4315c49c7c2c1ba78199c3946b381c-init/diff:/data/docker/overlay2/130f81d108823cb65aeb2d4370a8c71ffe0db40f088f26c16f987cc712b7238d/diff:/data/docker/overlay2/8220484c973a572a6a9c83ae1a16a5b34b448049c9fa96419ca56ca97959b830/diff:/data/docker/overlay2/a1b62ad1d3a6c1b3c5e186a4fdf406ab0dcd578c8476fa4b65ce008cf99bd73d/diff:/data/docker/overlay2/d33136d2b5652169a6f7ab76a4209be375ddf4f5fd4b12839a157b269ec9ea04/diff:/data/docker/overlay2/bd450a561912c6043a3c733af0ba5e2ac458cb3c2af0ff0a93f7eceac9828680/diff:/data/docker/overlay2/ecc604daa8220c0096d4650779fdac9416ea26b0c2ec3de4ad4dd1d23f4142c2/diff:/data/docker/overlay2/fd67ed0df8ee68254f9f03055ea856048bfd8afa3ec0c35bb7c515f35d3f3a01/diff:/data/docker/overlay2/67e424b4b991719e57482046423b940bdc7f16a658d134afded276e2303fb10b/diff:/data/docker/overlay2/1e287fd7962f340b71a37c6b5bf6b5715c42de0efa9cb6f2a203a948327ba85f/diff",
"MergedDir": "/data/docker/overlay2/f2c43a10d3bcab1f5f190cab08cd201c7b4315c49c7c2c1ba78199c3946b381c/merged",
"UpperDir": "/data/docker/overlay2/f2c43a10d3bcab1f5f190cab08cd201c7b4315c49c7c2c1ba78199c3946b381c/diff",
"WorkDir": "/data/docker/overlay2/f2c43a10d3bcab1f5f190cab08cd201c7b4315c49c7c2c1ba78199c3946b381c/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/home/user4docker/ftthapp/mailer/webapps",
"Destination": "/usr/local/tomcat/webapps",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "ceb08f179073",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"8080/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"https_proxy=https://198.18.37.248:3128",
"http_proxy=http://198.18.37.248:3128",
"HTTPS_PROXY=https://198.18.37.248:3128",
"HTTP_PROXY=http://198.18.37.248:3128",
"HTTPS_PROXY=https://198.18.37.248:3128",
"http_proxy=http://198.18.37.248:3128",
"https_proxy=https://198.18.37.248:3128",
"HTTP_PROXY=http://198.18.37.248:3128",
"PATH=/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/local/openjdk-8",
"JAVA_VERSION=8u265"
],
"Cmd": [
"java",
"-Dspring.profiles.active=prod",
"-jar",
"/webapps/mailer-1.0.0.jar"
],
"Image": "mailer",
"Volumes": {
"/usr/local/tomcat/webapps": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "5a6def467414d7328f02df00df1cc0299b83807ae08e23a344acfa6e89963f8a",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "ftthapp",
"com.docker.compose.project.config_files": "docker-compose.yml",
"com.docker.compose.project.working_dir": "/home/user4docker/ftthapp",
"com.docker.compose.service": "mailer",
"com.docker.compose.version": "1.25.1"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "b7446cbc478db125e37a90865da6ca44e226bd9f836c1fa07e6deb0d2fa8c36e",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8086"
}
]
},
"SandboxKey": "/var/run/docker/netns/b7446cbc478d",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"ftthapp_mynet": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"mailer",
"ceb08f179073"
],
"NetworkID": "a6c0bdf4b9de5df2990dfb19357e3bdcb8332676f1411937b57afdb828e7cbe9",
"EndpointID": "dae31f543f29fa3c30f04bc88f954df90107093eb69ebbc08e42274835599388",
"Gateway": "192.168.16.1",
"IPAddress": "192.168.16.12",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:c0:a8:10:0c",
"DriverOpts": null
}
}
}
}
]