Spring Boot can't read application.properties in Docker

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

My application.yml

  • Expose Docker Ports and Access with DNS for easier Ansible-Access
  • Pull docker image from AWS ECR using remote API
  • How to start service in docker container at start up
  • Docker on AWS. ECS or Docker Datacenter
  • Iscsid not starting on a centos6 docker on MacOS host
  • install docker on debian - 'overlay' is not supported over overlayfs
  • 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

  • ADD command with network path in Windows Containers Dockerfiles
  • VMWare VIC (Photon OS + Docker) vs CoreOS + Docker
  • where are the docker images stored in local disk
  • COPYing a file in a Dockerfile, no such file or directory?
  • Tilde Expansion Doesn't Work in Docker COPY Command
  • Alternatives to ssh X11-forwarding for Docker containers
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.