У меня есть докернизированное приложение Springboot, если я запускаю образ на своем компьютере (ubuntu), все отлично работает с docker сетевым режимом по умолчанию, как только я запускаю образ на корпоративном сервере (VPS) с настройками по умолчанию, он зависает при запуске и остается там навсегда.
2020-03-24 08:26:47.590 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.10.Final}
2020-03-24 08:26:47.821 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-03-24 08:26:48.015 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-03-24 08:26:48.125 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-03-24 08:26:48.151 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
или в режиме отладки
2020-03-24 08:19:43.856 DEBUG 1 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl : Send Buffer Size is 43,520
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@7b248da4
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] org.postgresql.Driver : Connecting with URL: jdbc:postgresql://157.46.186.128:62013/db
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] org.postgresql.jdbc.PgConnection : PostgreSQL JDBC Driver 42.2.9
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] org.postgresql.jdbc.PgConnection : setDefaultFetchSize = 0
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] org.postgresql.jdbc.PgConnection : setPrepareThreshold = 5
2020-03-24 08:19:43.935 DEBUG 1 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl : Trying to establish a protocol version 3 connection to 160.46.186.128:62013
2020-03-24 08:19:43.936 DEBUG 1 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl : Receive Buffer Size is 186,240
2020-03-24 08:19:43.937 DEBUG 1 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl : Send Buffer Size is 43,520
2020-03-24 08:19:44.007 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@205272d5
2020-03-24 08:19:44.008 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - After adding stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:20:10.592 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:20:39.272 DEBUG 1 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1585038039271 sessioncount 0
2020-03-24 08:20:39.272 DEBUG 1 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 1 expired sessions: 0
2020-03-24 08:20:40.592 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:21:10.593 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:21:39.274 DEBUG 1 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1585038099274 sessioncount 0
2020-03-24 08:21:39.274 DEBUG 1 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0
2020-03-24 08:21:40.593 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:22:10.594 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:22:39.277 DEBUG 1 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1585038159277 sessioncount 0
2020-03-24 08:22:39.277 DEBUG 1 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0
2020-03-24 08:22:40.594 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
2020-03-24 08:23:10.595 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=1, idle=9, waiting=0)
Я попытался настроить свою пользовательскую сеть на уровне docker, использовать ip, hostnames и не повезло , кто-нибудь испытывал такое же поведение?
Spring Config:
spring:
flyway:
url: jdbc:postgresql://157.46.186.128:62013/db
user: user
password: xxxxx
locations: classpath:db/migration
schemas: db1
datasource:
db:
jdbcUrl: "jdbc:postgresql://157.46.186.128:62013/db"
username: "user"
password: "xxxxx"
driver-class-name: "org.postgresql.Driver"
dialect: "org.hibernate.dialect.PostgreSQL95Dialect"
ci:
jdbcUrl: "jdbc:postgresql://157.46.186.128:62013/db"
username: "user"
password: "xxxxx"
driver-class-name: "org.postgresql.Driver"
dialect: "org.hibernate.dialect.PostgreSQL95Dialect"
schema: ci
docker сетевые настройки:
с режимом хоста
"Bridge": "",
"SandboxID": "49fa5d5e812c816a84efe92156e825151b2dc75a36bb68c399b943e06c26a6f7",
"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": "d6ecd673f06e15560a16dc5bb38ea4be99e751bfb729d819ab76c50320836443",
"EndpointID": "087b1a6fed2cd5b4de46c6700a9ef7e79de6fc3e58a0ecfdd74a8a851429eaa6",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
и без
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cf8d68a1b1c61d454ed45eb48f4007591d07414f2147410c1381d60e12b93445",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"7979/tcp": null,
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
}
]
},
"SandboxKey": "/var/run/docker/netns/cf8d68a1b1c6",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "49993412f56f7bd29edd55091bd77bba66a40ae566daf8111f891be9aa21d4ce",
"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": "bf5b2dfe32339838a40b351409fb7750f632a3810cb8774db195f49eed8a3ed5",
"EndpointID": "49993412f56f7bd29edd55091bd77bba66a40ae566daf8111f891be9aa21d4ce",
"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
}
}
}