Java + Docker: Different datasource url

I’m working on a Spring Boot project which I want to run in a docker environment. The project is split up in different modules each having it’s own Dockerfile so I’m using docker compose to combine these. I have one service for the db:

db:
      image: postgres:9.5
      ports:
       - 5432:5432
      environment:
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: 123456
        POSTGRES_DB: db1

The module which work with the db has the datasource set: spring.datasource.url= jdbc:postgresql://db:5432/db1

  • Error: failed to checkpoint one or more containers
  • How to setup jenkins blue ocean under Windows with docker agent
  • zeppelin can't communicate with Cassandra (docker, windows 10 host)
  • ELK process multiline logs from multiple docker images
  • Docker image TCP buffer size
  • Running RC2 project on defined port
  • The problem is that I have colleagues who do not want to run it in docker for performance reasons (Windows + Mac user). They rely on spring.datasource.url= jdbc:postgresql://localhost:5432/db1. Can I use different datasources depending on the environment the module is running?

  • Docker alpine image : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 “No such file or directory”)
  • Docker: Can I access to system files?
  • Using docker during build of Dockerfile
  • Is it possible to use Docker 17.03 secrets in Drupal 8?
  • Missing PID for process inside docker container
  • How can I test that a docker wordpress-fpm with custom plugins works
  • One Solution collect form web for “Java + Docker: Different datasource url”

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.