Skip to main content
Added linked potential duplicate.
Source Link

I've looked at SO posts related to this questions here, here, and here, and here but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

I've looked at SO posts related to this questions here, here, and here but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

I've looked at SO posts related to this questions here, here, here, and here but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

Added recommended fixes
Source Link

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail. My

EDIT

My stack.yml is below:

version: '3'
services:
  db:
    image: postgres
    restart: always
    container_name: db
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
      POSTGRES_DB: weg
    ports:
      - "5432:5432"
  weg-api:
    image: weg-api
    restart: always
    container_name: weg-api
    ports:
      - "8080:8080"
    depends_on:
      - "db"

EDIT

spring.datasource.url=jdbc:postgresql://localhostdb:5432/weg
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.generate-ddl=true

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail. My stack.yml is below:

version: '3'
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
      POSTGRES_DB: weg
    ports:
      - "5432:5432"
  weg-api:
    image: weg-api
    restart: always
    ports:
      - "8080:8080"
    depends_on:
      - "db"
spring.datasource.url=jdbc:postgresql://localhost:5432/weg
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.generate-ddl=true

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail.

EDIT

My stack.yml is below:

version: '3'
services:
  db:
    image: postgres
    restart: always
    container_name: db
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
      POSTGRES_DB: weg
    ports:
      - "5432:5432"
  weg-api:
    image: weg-api
    restart: always
    container_name: weg-api
    ports:
      - "8080:8080"
    depends_on:
      - "db"

EDIT

spring.datasource.url=jdbc:postgresql://db:5432/weg
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.generate-ddl=true
added 134 characters in body
Source Link
Aserre
  • 5.1k
  • 5
  • 38
  • 59

I've looked at SO posts related to this questions [here][1]here, [here][2]here, and [here][3]here but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1       | 2018-07-04 14:57:15.388 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1       | 2018-07-04 14:57:15.402 UTC [23] LOG:  database system was interrupted; last known up at 2018-07-04 14:45:24 UTC
db_1       | 2018-07-04 14:57:15.513 UTC [23] LOG:  database system was not properly shut down; automatic recovery in progress
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo starts at 0/16341E0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  invalid record length at 0/1634218: wanted 24, got 0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo done at 0/16341E0
db_1       | 2018-07-04 14:57:15.525 UTC [1] LOG:  database system is ready to accept connections
weg-api_1  | 
weg-api_1  |   .   ____          _            __ _ _
weg-api_1  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
weg-api_1  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
weg-api_1  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
weg-api_1  |   '  |____| .__|_| |_|_| |_\__, | / / / /
weg-api_1  |  =========|_|==============|___/=/_/_/_/
weg-api_1  |  :: Spring Boot ::        (v1.5.3.RELEASE)
weg-api_1  | 
weg-api_1  | 2018-07-04 14:57:16.908  INFO 7 --- [           main] api.ApiKt                                : Starting ApiKt v0.0.1-SNAPSHOT on f9c58f4f2f27 with PID 7 (/app/spring-jpa-postgresql-spring-boot-0.0.1-SNAPSHOT.jar started by root in /app)
weg-api_1  | 2018-07-04 14:57:16.913  INFO 7 --- [           main] api.ApiKt                                : No active profile set, falling back to default profiles: default
weg-api_1  | 2018-07-04 14:57:17.008  INFO 7 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5e91e4: startup date [Wed Jul 04 14:57:17 GMT 2018]; root of context hierarchy
weg-api_1  | 2018-07-04 14:57:19.082  INFO 7 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
weg-api_1  | 2018-07-04 14:57:19.102  INFO 7 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
weg-api_1  | 2018-07-04 14:57:19.104  INFO 7 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2211 ms
weg-api_1  | 2018-07-04 14:57:19.370  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
weg-api_1  | 2018-07-04 14:57:19.375  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.867 ERROR 7 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
weg-api_1  | 
weg-api_1  | 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.```

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail.  My stack.yml is below:

    version: '3'
    services:
      db:
        image: postgres
        restart: always
        environment:
          POSTGRES_USER: root
          POSTGRES_PASSWORD: password
          POSTGRES_DB: weg
        ports:
          - "5432:5432"
      weg-api:
        image: weg-api
        restart: always
        ports:
          - "8080:8080"
        depends_on:
          - "db"

My Springboot application properties are below:

    spring.datasource.url=jdbc:postgresql://localhost:5432/weg
    spring.datasource.username=root
    spring.datasource.password=password
    spring.jpa.generate-ddl=true

I'm at a loss as to how to proceed.

  [1]: https://stackoverflow.com/questions/48350843/how-to-connect-from-docker-compose-to-host-postgresql
  [2]: https://stackoverflow.com/questions/38199851/mongodb-connection-refused-docker-compose
  [3]: https://stackoverflow.com/questions/45122028/docker-compose-up-connection-refused
Attaching to weg-api_db_1, weg-api_weg-api_1
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1       | 2018-07-04 14:57:15.388 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1       | 2018-07-04 14:57:15.402 UTC [23] LOG:  database system was interrupted; last known up at 2018-07-04 14:45:24 UTC
db_1       | 2018-07-04 14:57:15.513 UTC [23] LOG:  database system was not properly shut down; automatic recovery in progress
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo starts at 0/16341E0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  invalid record length at 0/1634218: wanted 24, got 0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo done at 0/16341E0
db_1       | 2018-07-04 14:57:15.525 UTC [1] LOG:  database system is ready to accept connections
weg-api_1  | 
weg-api_1  |   .   ____          _            __ _ _
weg-api_1  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
weg-api_1  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
weg-api_1  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
weg-api_1  |   '  |____| .__|_| |_|_| |_\__, | / / / /
weg-api_1  |  =========|_|==============|___/=/_/_/_/
weg-api_1  |  :: Spring Boot ::        (v1.5.3.RELEASE)
weg-api_1  | 
weg-api_1  | 2018-07-04 14:57:16.908  INFO 7 --- [           main] api.ApiKt                                : Starting ApiKt v0.0.1-SNAPSHOT on f9c58f4f2f27 with PID 7 (/app/spring-jpa-postgresql-spring-boot-0.0.1-SNAPSHOT.jar started by root in /app)
weg-api_1  | 2018-07-04 14:57:16.913  INFO 7 --- [           main] api.ApiKt                                : No active profile set, falling back to default profiles: default
weg-api_1  | 2018-07-04 14:57:17.008  INFO 7 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5e91e4: startup date [Wed Jul 04 14:57:17 GMT 2018]; root of context hierarchy
weg-api_1  | 2018-07-04 14:57:19.082  INFO 7 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
weg-api_1  | 2018-07-04 14:57:19.102  INFO 7 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
weg-api_1  | 2018-07-04 14:57:19.104  INFO 7 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2211 ms
weg-api_1  | 2018-07-04 14:57:19.370  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
weg-api_1  | 2018-07-04 14:57:19.375  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.867 ERROR 7 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
weg-api_1  | 
weg-api_1  | 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.

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail. My stack.yml is below:

version: '3'
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
      POSTGRES_DB: weg
    ports:
      - "5432:5432"
  weg-api:
    image: weg-api
    restart: always
    ports:
      - "8080:8080"
    depends_on:
      - "db"

My Springboot application properties are below:

spring.datasource.url=jdbc:postgresql://localhost:5432/weg
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.generate-ddl=true

I'm at a loss as to how to proceed.

I've looked at SO posts related to this questions [here][1], [here][2], and [here][3] but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1       | 2018-07-04 14:57:15.388 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1       | 2018-07-04 14:57:15.402 UTC [23] LOG:  database system was interrupted; last known up at 2018-07-04 14:45:24 UTC
db_1       | 2018-07-04 14:57:15.513 UTC [23] LOG:  database system was not properly shut down; automatic recovery in progress
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo starts at 0/16341E0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  invalid record length at 0/1634218: wanted 24, got 0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo done at 0/16341E0
db_1       | 2018-07-04 14:57:15.525 UTC [1] LOG:  database system is ready to accept connections
weg-api_1  | 
weg-api_1  |   .   ____          _            __ _ _
weg-api_1  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
weg-api_1  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
weg-api_1  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
weg-api_1  |   '  |____| .__|_| |_|_| |_\__, | / / / /
weg-api_1  |  =========|_|==============|___/=/_/_/_/
weg-api_1  |  :: Spring Boot ::        (v1.5.3.RELEASE)
weg-api_1  | 
weg-api_1  | 2018-07-04 14:57:16.908  INFO 7 --- [           main] api.ApiKt                                : Starting ApiKt v0.0.1-SNAPSHOT on f9c58f4f2f27 with PID 7 (/app/spring-jpa-postgresql-spring-boot-0.0.1-SNAPSHOT.jar started by root in /app)
weg-api_1  | 2018-07-04 14:57:16.913  INFO 7 --- [           main] api.ApiKt                                : No active profile set, falling back to default profiles: default
weg-api_1  | 2018-07-04 14:57:17.008  INFO 7 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5e91e4: startup date [Wed Jul 04 14:57:17 GMT 2018]; root of context hierarchy
weg-api_1  | 2018-07-04 14:57:19.082  INFO 7 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
weg-api_1  | 2018-07-04 14:57:19.102  INFO 7 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
weg-api_1  | 2018-07-04 14:57:19.104  INFO 7 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2211 ms
weg-api_1  | 2018-07-04 14:57:19.370  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
weg-api_1  | 2018-07-04 14:57:19.375  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.867 ERROR 7 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
weg-api_1  | 
weg-api_1  | 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.```

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail.  My stack.yml is below:

    version: '3'
    services:
      db:
        image: postgres
        restart: always
        environment:
          POSTGRES_USER: root
          POSTGRES_PASSWORD: password
          POSTGRES_DB: weg
        ports:
          - "5432:5432"
      weg-api:
        image: weg-api
        restart: always
        ports:
          - "8080:8080"
        depends_on:
          - "db"

My Springboot application properties are below:

    spring.datasource.url=jdbc:postgresql://localhost:5432/weg
    spring.datasource.username=root
    spring.datasource.password=password
    spring.jpa.generate-ddl=true

I'm at a loss as to how to proceed.

  [1]: https://stackoverflow.com/questions/48350843/how-to-connect-from-docker-compose-to-host-postgresql
  [2]: https://stackoverflow.com/questions/38199851/mongodb-connection-refused-docker-compose
  [3]: https://stackoverflow.com/questions/45122028/docker-compose-up-connection-refused

I've looked at SO posts related to this questions here, here, and here but I haven't had any luck with the fixes proposed. Whenever I run the command docker-compose -f stack.yml up I receive the following stack trace:

Attaching to weg-api_db_1, weg-api_weg-api_1
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1       | 2018-07-04 14:57:15.384 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1       | 2018-07-04 14:57:15.388 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1       | 2018-07-04 14:57:15.402 UTC [23] LOG:  database system was interrupted; last known up at 2018-07-04 14:45:24 UTC
db_1       | 2018-07-04 14:57:15.513 UTC [23] LOG:  database system was not properly shut down; automatic recovery in progress
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo starts at 0/16341E0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  invalid record length at 0/1634218: wanted 24, got 0
db_1       | 2018-07-04 14:57:15.515 UTC [23] LOG:  redo done at 0/16341E0
db_1       | 2018-07-04 14:57:15.525 UTC [1] LOG:  database system is ready to accept connections
weg-api_1  | 
weg-api_1  |   .   ____          _            __ _ _
weg-api_1  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
weg-api_1  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
weg-api_1  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
weg-api_1  |   '  |____| .__|_| |_|_| |_\__, | / / / /
weg-api_1  |  =========|_|==============|___/=/_/_/_/
weg-api_1  |  :: Spring Boot ::        (v1.5.3.RELEASE)
weg-api_1  | 
weg-api_1  | 2018-07-04 14:57:16.908  INFO 7 --- [           main] api.ApiKt                                : Starting ApiKt v0.0.1-SNAPSHOT on f9c58f4f2f27 with PID 7 (/app/spring-jpa-postgresql-spring-boot-0.0.1-SNAPSHOT.jar started by root in /app)
weg-api_1  | 2018-07-04 14:57:16.913  INFO 7 --- [           main] api.ApiKt                                : No active profile set, falling back to default profiles: default
weg-api_1  | 2018-07-04 14:57:17.008  INFO 7 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5e91e4: startup date [Wed Jul 04 14:57:17 GMT 2018]; root of context hierarchy
weg-api_1  | 2018-07-04 14:57:19.082  INFO 7 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
weg-api_1  | 2018-07-04 14:57:19.102  INFO 7 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
weg-api_1  | 2018-07-04 14:57:19.104  INFO 7 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
weg-api_1  | 2018-07-04 14:57:19.215  INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2211 ms
weg-api_1  | 2018-07-04 14:57:19.370  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
weg-api_1  | 2018-07-04 14:57:19.375  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.376  INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
weg-api_1  | 2018-07-04 14:57:19.867 ERROR 7 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
weg-api_1  | 
weg-api_1  | 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.

I thought that my .yml file was brain-dead-simple, but I must be missing something vital for the internal routing between the two containers to fail. My stack.yml is below:

version: '3'
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
      POSTGRES_DB: weg
    ports:
      - "5432:5432"
  weg-api:
    image: weg-api
    restart: always
    ports:
      - "8080:8080"
    depends_on:
      - "db"

My Springboot application properties are below:

spring.datasource.url=jdbc:postgresql://localhost:5432/weg
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.generate-ddl=true

I'm at a loss as to how to proceed.

Source Link
Loading