I am new to the concept of Docker. In my office server we have installed Docker and running the Jenkins images as containers.
We want to run the below command in the Jenkinsfile in a process to create the Jenkins pipeline.
docker run --rm -p 8080:8080 -v $PWD/app:/opt/app --name=app-server App
The problem is face is the volumes are not mounting in the /opt/app
from the $PWD/app
(which is the volume of the Jenkins container).
I have app.txt
file in the $PWD/app
. After running the above command it should present in the /opt/app
, but the folder is empty.
Because of this the configuration files are missing in the app-server container volume. Error config files are missing
is happening.
What is the reason for this problem. Why the files in the $PWD/app
are not mounting to the /opt/app
folder?
Point to consider:
docker run
command is running in the Jenkins container.
The command on top is running prefect when the jenkins is running locally,not as docker container.