I am trying to store nexus data in persistent volume. To do that I am using this compose yaml:
version: '3.5'
services:
nexus:
image: sonatype/nexus3
volumes:
- ./nexus-data:/nexus-data sonatype/nexus3
ports:
- "8081:8081"
networks:
- devops
extra_hosts:
- "my-proxy:my-proxy-address"
restart: on-failure
networks:
devops:
name: devops
driver: bridge
Before running docker-compose up
I have created the nexus-data
folder and gave required permissions to the uid/guid 200
as suggested here:
https://github.com/sonatype/docker-nexus3/blob/master/README.md#persistent-data.
root@master-node:~/docker# ll
total 16
drwxr-xr-x 3 root root 4096 Jan 8 13:37 ./
drwx------ 22 root root 4096 Jan 8 13:40 ../
-rw-r--r-- 1 root root 319 Jan 8 13:36 docker-compose.yml
drwxr-xr-x 2 200 200 4096 Jan 8 13:37 nexus-data/
And here docker's volumes list before running compose file (it's empty):
root@master-node:~/docker# docker volume ls
DRIVER VOLUME NAME
After docker-compose up
command, docker created the volume as shown below:
root@master-node:~/docker# docker volume ls
DRIVER VOLUME NAME
local 7b7b6517e5ed0e286a8fc7caef756141b5bbdb6e074ef93a657850da3dd78b2b
root@master-node:~/docker# docker volume inspect 7b7b6517e5ed0e286a8fc7caef756141b5bbdb6e074ef93a657850da3dd78b2b
[
{
"CreatedAt": "2020-01-08T13:42:34+03:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/7b7b6517e5ed0e286a8fc7caef756141b5bbdb6e074ef93a657850da3dd78b2b/_data",
"Name": "7b7b6517e5ed0e286a8fc7caef756141b5bbdb6e074ef93a657850da3dd78b2b",
"Options": null,
"Scope": "local"
}
]
root@master-node:~/docker# ls /var/lib/docker/volumes/7b7b6517e5ed0e286a8fc7caef756141b5bbdb6e074ef93a657850da3dd78b2b/_data
admin.password cache db elasticsearch etc generated-bundles instances javaprefs karaf.pid keystores lock log orient port restore-from-backup tmp
but the folder I specified in compose file (nexus-data
) is still empty:
root@master-node:~/docker# ls nexus-data/
root@master-node:~/docker#
So, what am I doing wrong here? Why isnexus-data
empty and docker creating volume in another path?