Docker Community Forums

Share and learn in the Docker community.

Mount a volume?

docker

(Thufirh) #1

What does it mean to to “mount a volume” below?

However, this will run without any configuration what-so-ever, so you'll want to mount a volume with your configurations, a sample configuration is provided in this clone. So if your current working directory is this clone, you could mount the example configurations in /etc/asterisk however, I recommend you create your own configurations.

Docker containers run inside Linux. Firstly, what is there to mount? The filesystem is already mounted. Secondly, why? The container, the OS in the container, is already running? What would be achieved by mounting anything?


(David Maze) #2

Inject some additional bit of filesystem into the container, with docker run -v or an equivalent option on a higher-level tool. If you have a daemon with a complex configuration file, a typical setup is to create the config file on the host somewhere and then docker run -v /opt/asterisk/config:/etc/asterisk or some such to push it in on startup.

Remember that containers are mortal, and it’s pretty routine to stop and delete them, so if you have something like a config file that you need to be there when you stop and delete and recreate the container, it needs to live outside the container; docker run -v is the mechanism to push that in.

(In Kubernetes you can do the same thing with a configMap; I don’t know if there’s a good Docker Swarm equivalent.)


(Sam) #3

suppose you had some data you wanted the application in the container to use. (in one case I had a 1.5gb tar file)
why copy it into the container…

with the unix systems you can ‘mount’ a folder anywhere in the directory tree… (with the mount command)

or, run a web site, but not have to change the container when the web content changes… you can mount a host folder at /var/www/html in the container (this is the default apache web site root path)