2

Here my DockerFile :-

FROM openjdk:10
ENV AQUILA_HOME /data/config
#USER root
#VOLUME /tmp
ADD a2i-web-1.0.0-SNAPSHOT.jar app.jar
#RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-jar","app.jar"]

My jar is spring boot application which refers configuration file from some directory [/data/config/config.properties] I am building DockerFile successfully by command

sudo docker build -t dockImgName/a2i-web:v1 .

But while running it by command

sudo docker run -p 8080:8080 -t dockImgName/a2i-web:v1

giving exception as :

Caused by: java.io.FileNotFoundException: /data/config/config.properties (No such file or directory)

I am running this dcoker command from directory containing DockerFile and my jar Do I need to set any configuration to get config file directory?

1 Answer 1

1

The error message is quite clear. When the container tries to run it is not able to find properties file.

You need to add config.properties file to your docker image.

ADD path_to_config_file/config.properties /data/config/config.properties

NOTE: path_to_config_file refers to the file path in your local where you are building the dockerfile

Sign up to request clarification or add additional context in comments.

5 Comments

what is path_to_config_file?
While building, it giving error as "ADD failed: stat /var/lib/docker/tmp/docker-builder317118205/config.properties: no such file or directory"
Putting config.properties file in same directory as DockerFile is solved this problem..It helped
How to bind folder ? I have may files to be used under folder
I think dir can be similarly added like file, ADD path_to_config_dir/ /data/config/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.