Reputation: 41
I have data from the current version(3.3.1) on a volume and I want the data to show up in the new nexus. When I try below the docker run command and go to nexus, new repositories do not show up, but data is there for old repos.
docker run -d -p 8081:8081 --name nexus -v <local-docker-volume>:/nexus-data newimage
The Dockerfile I use to create an image
FROM sonatype/nexus3:3.17.0
COPY path-to-bak-files/*.bak /nexus-data/restore-from-backup/
Any idea what I am doing wrong?
p.s: let me know if I am not clear.
Upvotes: 1
Views: 1443
Reputation: 1394
As per your dockerfile you are copying the contents to /nexus-data/restore-from-backup/
but while running the container you are mounting the existing volume on /nexus-data
which ends up masking the /nexus-data
directory on file system inside the container (where you added the data while image creation).
Important thing to note in mount operation is that if you mount another disk/share (in this case volume) on an existing directory on your file system(FS), you can't access the dir from your FS anymore. Thus, when you created docker image, you added some files to /nexus-data/restore-from-backup/ but when you mounted volume on /nexus-data, you mounted it over dir in your FS so you can't see files now from your FS.
To address the issue, you can do the following:
location1
location1
to /nexus-data/restore-from-backup/
Upvotes: 1