Is it possible to bind multiple folders in Docker?
For example, like ports:
-p 3000:3000 -p 3022:22
The idea seems like:
-v path:path -v path2:path2
Is this possible?
No problem at all.
You can specify files and directories like in this example taken from a tomcat container to blend in certificates. (:ro
is optional for read only)
-v $(pwd)/secret-files/certificates/verisign.keystore:$CONFIG_PATH/certificates/verisign.keystore:ro \
-v $(pwd)/secret-files/certificates/fuse/:$CONFIG_PATH/certificates/fuse/:ro \
Docker allows mounting (or binding) multiple folders. Here is the Docker documentation which clearly mention this : link
-v, --volume=[] Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
You can add a data volume to a container using the -v flag with the docker create and docker run command. You can use the -v multiple times to mount multiple data volumes.
Example (from what I do) :
docker run -v /opt/rpms:/opt/rpms/ -v /export/centos6_1/app/logs:/export/centos6_1/app/logs -t -i centos6_1 /bin/bash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With