Share and update docker data containers across containers -
i have following containers:
- data container build directly in quay.io github repo, website.
- fpm container
- nginx container
the 3 of them linked , working fine. problem every time change in website (data container) rebuilt (of course) , have remove container , fpm , nginx , recreate them able read new content.
i started "backup approach" i'm copying data container host directory , mounting fpm , nginx containers, way can update data without restarting/removing service.
but idea of moving data data container host, doesn't me. wondering if there "docker way" or better way of doing it.
thanks!
update: adding more context
dockerfile d`ata container definition
from debian add data/* /home/mustela/ volume /home/mustela/
where data
has 2 files: hello.1
, hello.2
compiling image:
docker build -t="mustela/data" .
running data container:
docker run --name mustela-data mustela/data
creating container link previous one:
docker run -d -it --name nginx --volumes-from mustela-data ubuntu bash
listing mounted files:
docker exec -it nginx ls /mustela/home
result:
hello.1 hello.2
now, lets rebuild data container image, first adding new files, inside data
have hello.1 hello.2 hello.3 hello.4
docker rm mustela-data docker build -t="mustela/data" . docker run --name mustela-data mustela/data
if ls /home/mustela
running container, files aren't being updated:
docker exec -it nginx ls /mustela/home
result:
hello.1 hello.2
but if run new container can see files
docker run -it --name nginx2 --volumes-from mustela-data ubuntu ls /home/mustela
result: hello.1 hello.2 hello.3 hello.4
Comments
Post a Comment