Reputation: 1893
I am using the following command to run my container
docker run -d -p 9001:8081 --name nexus -v /Users/user.name/dockerVolume/nexus:/nexus-data sonatype/nexus3
Container starts and fail immediately. with the following logs
mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
mkdir: cannot create directory '../sonatype-work/nexus3/tmp': Permission denied
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No such file or directory
I was following this link to set it up I have given said permission to nexus directory.
I also tried the following SO link but that didn't help me either. I was still getting the same error.
Docker Version 17.12.0-ce-mac47 (21805)
[EDIT] I did made changes to the ownership of my nexus folder on my host
sudo chown -R 200 ~/dockerVolume/nexus
Upvotes: 7
Views: 18847
Reputation: 1
Nexus Repository stores its data in the /sonatype-work directory by default (check this link)
so instead of /nexus-data try to use /sonatype-work for exp:
docker run -p 8081:8081 -v /data/nexus:/sonatype-work --name nexus -d sonatype/nexus3
Upvotes: 0
Reputation: 257
If you have this problem trying to run Nexus3 inside of Kubernetes cluster, you should set UID with initContainers. Just add it to your spec:
initContainers:
- name: volume-mount-hack
image: busybox
command: ["sh", "-c", "chown -R 200:200 /nexus-data"]
volumeMounts:
- name: <your nexus pvc volume name>
mountPath: /nexus-data
Upvotes: 15
Reputation: 555
In my ubuntu server I had to perform:
chown -R 200:200 path/to/directory
Not only 200, but 200:200
Upvotes: 20
Reputation: 1324657
That Dockerfile is available, in the repo sonatype/docker-nexus3
.
And mounting a volume is documented as:
Mount a host directory as the volume.
This is not portable, as it relies on the directory existing with correct permissions on the host. However it can be useful in certain situations where this volume needs to be assigned to certain specific underlying storage.
$ mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data
$ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
So don't forget to do, before your docker run
:
chown -R 200 /Users/user.name/dockerVolume/nexus
Upvotes: 3