Reputation: 5849
Before anything, I have read this question and the related links in it, but I am still confused about how to resolve this on my setup.
I wrote my own docker file to install Archiva, which is very similar to this file. I created an image from the docker file using docker build -t archiva .
and have a container which I run using docker run archiva
. As seen in the docker file, the user data that I want to preserve is in a volume
.
Now I want to upgrade to Archive 2.2.0. How can I update my container, so that the user-data thats in the volume is preserved? If I change the docker file by h=just changing the version number, and run the docker build
again, it will just create another container.
Upvotes: 0
Views: 117
Reputation: 3798
The option --volume
of the docker-run
enables sharing files between host and container(s) and especially preserve consistent [user] data.
.. it appears that you are not using --volume
and that the user data are in the image. (and that's a bad practice beacuse it leads to the situation you are in: unable to upgrade a service easily.
To use the command docker-cp
: "Copy files/folders between a container and the local filesystem.
"
docker cp [--help] CONTAINER:SRC_PATH DEST_PATH
Dockerfile
By editing your Dockerfile
and changing the version.
--volume
optionUse docker run -v /host/path/user-data:container/path/user-data archiva
And you're good!
Upvotes: 1