There is a possibility you may need to access the Jenkins home directory, for
instance, to check the details of a Jenkins build in the
workspace
subdirectory.
If you mapped the Jenkins home directory (
/var/jenkins_home
) to one on your
machine’s local file system (i.e. in the
docker run …
command
above), then you can access the
contents of this directory through your machine’s usual terminal/command prompt.
Otherwise, if you specified the
--volume jenkins-data:/var/jenkins_home
option in
the
docker run …
command, you can access the contents of the Jenkins home
directory through your container’s terminal/command prompt using the
docker container exec
command:
docker container exec -it <docker-container-name> bash
As mentioned above,
your
<docker-container-name>
can be obtained using the
docker container ls
command. If you specified the
--name jenkins-blueocean
option in the
docker container run …
command above (see also
Accessing the Jenkins/Blue
Ocean Docker container
), you can simply use the
docker container exec
command:
docker container exec -it jenkins-blueocean bash