Spring Boot can't read application.properties in Docker

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

My application.yml

  • OS X Docker does not set repo name nor tag after build
  • docker-compose - unable to attach to containers
  • Best way to to implement Spark + AWS + Caffe/CUDA?
  • kubernetes service external ip pending
  • docker-compose: Modify environment variable
  • Docker apache2 will not consider new 000-default.conf
  • 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

  • Virtualize my VPS
  • Using customized AMI in Elastic Beanstalk (Multi-container Docker) via awsebcli
  • Mongodb collection insert ignoring unique index
  • Error 500 when running exec start with Docker Remote API
  • Can't open file when i try to run a shell script inside Docker container
  • Can travis-ci run docker?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.