Spring Boot can't read application.properties in Docker

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

My application.yml

  • Exposing multiple ports from Docker within Elastic Beanstalk
  • Simple docker deployment tactics
  • Can't connect to Cassandra Docker Container
  • Can't run Ecplise Che under ubuntu
  • What to do with pid files in a docker container
  • How to configure a GlassFish instance running on AWS/ElasticBeanstalk/Docker?
  • 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

  • How to run the Google app engine server using Dockerfile
  • Docker Daemon for Windows
  • error 7#7: *1 upstream prematurely closed connection while reading response header from upstream
  • RavenDb - Status Code: NotFound
  • mysql_install_db in Docker container returns error
  • How to set up executor IPs inside Docker containers?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.