Hi Forghetti,
I did same thing like following;
1- $ docker run --detach --name postgre --env POSTGRES_PASSWORD=xxxx --publish 5432:5432 postgres:latest
3af43a813f011d792376c2a34c2c1a27763fdb5bb393782d2582afeacc52ae88
2- $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3af43a813f01 postgres:latest “docker-entrypoint.s…” 10 seconds ago Up 7 seconds 0.0.0.0:5432->5432/tcp postgre
0ff60bb165b1 postgres “docker-entrypoint.s…” About an hour ago Up About an hour 0.0.0.0:5433->5432/tcp loving_lewin
3- $ docker container top postgre
UID PID PPID C STIME TTY TIME CMD
999 5565 5548 0 19:51 ? 00:00:00 postgres
999 5652 5565 0 19:51 ? 00:00:00 postgres: checkpointer
999 5653 5565 0 19:51 ? 00:00:00 postgres: background writer
999 5654 5565 0 19:51 ? 00:00:00 postgres: walwriter
999 5655 5565 0 19:51 ? 00:00:00 postgres: autovacuum launcher
999 5656 5565 0 19:51 ? 00:00:00 postgres: stats collector
999 5657 5565 0 19:51 ? 00:00:00 postgres: logical replication launcher
4- $ docker container logs postgre
The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.utf8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … ok
syncing data to disk … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
waiting for server to start…2019-02-09 19:51:09.244 UTC [40] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2019-02-09 19:51:09.273 UTC [41] LOG: database system was shut down at 2019-02-09 19:51:06 UTC
2019-02-09 19:51:09.283 UTC [40] LOG: database system is ready to accept connections
done
server started
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2019-02-09 19:51:09.315 UTC [40] LOG: received fast shutdown request
waiting for server to shut down…2019-02-09 19:51:09.321 UTC [40] LOG: aborting any active transactions
2019-02-09 19:51:09.324 UTC [40] LOG: background worker “logical replication launcher” (PID 47) exited with exit code 1
2019-02-09 19:51:09.325 UTC [42] LOG: shutting down
2019-02-09 19:51:09.396 UTC [40] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2019-02-09 19:51:09.431 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
2019-02-09 19:51:09.432 UTC [1] LOG: listening on IPv6 address “::”, port 5432
2019-02-09 19:51:09.444 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2019-02-09 19:51:09.465 UTC [49] LOG: database system was shut down at 2019-02-09 19:51:09 UTC
2019-02-09 19:51:09.473 UTC [1] LOG: database system is ready to accept connections
5- After all I want to run but I got error;
$ docker run -p 8761:8761 product-service
2019-02-09 19:51:25.666 INFO 1 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration’ of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a88d0b34] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\ / ’ __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ’ / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
’ || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.1.1.RELEASE)
2019-02-09 19:51:26.689 INFO 1 — [ main] com.pcomm.ProductServiceApplication : No active profile set, falling back to default profiles: default
2019-02-09 19:51:30.390 INFO 1 — [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-02-09 19:51:30.637 INFO 1 — [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 229ms. Found 2 repository interfaces.
2019-02-09 19:51:31.043 WARN 1 — [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID ‘service-registry’ contains invalid characters, please migrate to a valid format.
2019-02-09 19:51:32.351 INFO 1 — [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=a760eb4b-bf65-3569-80fd-e872d54af068
2019-02-09 19:51:32.516 INFO 1 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘com.pcomm.product.feignclient.ProductServiceClient’ of type [org.springframework.cloud.openfeign.FeignClientFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-02-09 19:51:32.910 INFO 1 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration’ of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8c730837] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-02-09 19:51:33.016 INFO 1 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration’ of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a88d0b34] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-02-09 19:51:34.292 INFO 1 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8761 (http)
2019-02-09 19:51:34.424 INFO 1 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-02-09 19:51:34.425 INFO 1 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-02-09 19:51:34.458 INFO 1 — [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/…/lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2019-02-09 19:51:34.770 INFO 1 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-02-09 19:51:34.774 INFO 1 — [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 8005 ms
2019-02-09 19:51:35.193 WARN 1 — [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-02-09 19:51:35.194 INFO 1 — [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-02-09 19:51:35.272 INFO 1 — [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@5c18016b
2019-02-09 19:51:38.336 INFO 1 — [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version ‘Jersey: 1.19.1 03/11/2016 02:08 PM’
2019-02-09 19:51:38.705 INFO 1 — [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-02-09 19:51:38.710 INFO 1 — [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-02-09 19:51:39.378 INFO 1 — [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-02-09 19:51:39.383 INFO 1 — [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-02-09 19:51:40.628 INFO 1 — [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting…
2019-02-09 19:51:41.765 ERROR 1 — [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:280) ~[postgresql-42.2.5.jar!/:42.2.5]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.5.jar!/:42.2.5]
at org.postgresql.jdbc.PgConnection.(PgConnection.java:195) ~[postgresql-42.2.5.jar!/:42.2.5]
at org.postgresql.Driver.makeConnection(Driver.java:454) ~[postgresql-42.2.5.jar!/:42.2.5]
at org.postgresql.Driver.connect(Driver.java:256) ~[postgresql-42.2.5.jar!/:42.2.5]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.HikariDataSource$$FastClassBySpringCGLIB$$eeb1ae86.invoke() [HikariCP-3.2.0.jar!/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) [spring-aop-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) [spring-aop-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) [spring-aop-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:18…