Spring Boot can't read application.properties in Docker

Spring Boot doesn’t read application properties when running in Docker container.

My application.yml

  • ZeroMQ fails to .bind() on Docker on [] - address already in use. Why?
  • Does anyone know a workaround for no-new-privileges blocking selinux transitions in docker?
  • Errors with alpine linux 3.5 and ruby 2.0?
  • Bcrypt installation fails in Docker
  • All public image pulls fail with “filesystem layer verification failed for digest sha256”
  • prevent rebuilding whole docker container everytime? improving speed
  • server:
      port: 8080
      context-path: /mail
      greeting: Hello YML


    FROM java:8-jre
    VOLUME /tmp
    COPY ./mail.jar /app/mail.jar
    RUN sh -c 'touch /app/mail.jar'
    ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app/mail.jar" ]
    EXPOSE 8080

    And a simple ApplicationController

    public class ApplicationController {
      private final Environment environment;
      public ApplicationController(Environment environment) {
        this.environment = environment;
      @RequestMapping(path = "/")
      public Hello hello() {
        final Hello hello = new Hello();
        return hello;

    I’m using IntelliJ Docker plugin that automatically map ports 8080(docker):18080(host) and makes app available on http://localhost:18080


    1. server.context-path property isn’t applied. App still available with / and not with /mail/
    2. custom.greeting property not reads from properties file and controller returns {“greeting”:null} instead {“greeting”:”Hello YML”}

    Without Docker

    1. context-path applied properly

    2. custom.greeting property returns by controller properly

  • Using the Spotify Maven Docker plugin, how can I change the file permissions of a resource that I add to a Docker container?
  • How can I tell if I'm logged in to a private Docker registry from a script?
  • Google Cloud Container Registry Issues while pushing docker images
  • How to create data volume in docker?
  • Docker compose named volume: find volume on host machine
  • Logging in Docker
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.