I have a directory(maybe later volume), that I would like to share with all my interactive containers. I know, that native Docker volumes are stored under /var/lib/docker/volumes
and docker run -v
seems the easiest way, but I think Data Volume Container
is a much more standardized way. I don't know, how to create this volume container from a directory or an existing another volume. Maybe is it wrong method?
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
There are two ways to create and share volumes: 1. using the
VOLUME
instruction on theDockerfile
. 2 Specifying the-v <volume_name>
option during container runtime and later using--volumes-from=<container>
with every subsequent container which need to share the data. Here is an ex with the later:-v
, then add a test file under the directory of the shared volume.docker inspect ca30f0f99401 | grep -i --color -E '^|Vol'
Make a data volume container by writing a dedicated Dockerfile in which you would:
COPY
your folder in itVOLUME
Then
docker create <imagename>
and you get a (created) container, that you can mount in all your other containers, provided you run them with the--volumes-from <containername>
option.