Docker Community Forums

Share and learn in the Docker community.

Adding Two docker volumes (on the same host partition) to a container doesn't work?!?


(Petr Blavov) #1

Hi everyone,
I’m trying to get a docker-based JIRA setup working with persistent storage for the two relevant config directories. The host is running Ubintu linux 16.04 and Docker version 17.09.0-ce, the image I’m using is “cptactionhank/atlassian-jira-software”, though that doesn’t seem to be relevant.

I’ve created two subdirs on the machine to be mapped to /opt/atlassian/jira and /var/altassian/jira, respectively; yet, when I type

docker run -d --name jirasw --volume /docker/data/jira-sw-var:/var/atlassian:rw  --volume /docker/data/jira-sw-opt:/opt/atlassian:rw -p 8080:8080 --link jiradb:db cptactionhank/atlassian-jira-software:latest                                                            

only the first volume listed above (jira-sw-var) is actually present inside the container, the second one is just the container’s original directory. And if I swap the two container parameters in the command line, then the other volume (jira-sw-opt) appears inside the container, but the first one is nowhere to be found. So, it looks like only the first volume listed in the command line is added to the container.

Both volumes are on the same file system by the way - the machine only has one data partition, so I can’t move the volume to another partition.

I’ve already tried to use volume containers and the “–volumes-from” parameter, plus bind mounts instead to volumens, to no avail. I cannot get both volumes “into” the container at the same time.

Is this a known limitation of docker? What can I do to provide both subdirs to the container from a consistent place accessible to the host? Any help uis appreaciated!

Cheers, Pit.

(Sam) #2

do you have read permission to /opt?

(Petr Blavov) #3

(I assume you mean the /opt/ inside the container)

Yes, otherwise, I could not have seen that the /opt directory in one case contained the volume I wanted (but /var/atlassian wasn’'t overloaded), and in the other case it contained only the container files (but /var/ was properly mounted from the host).

(Petr Blavov) #4

Can anyone confirm that this is a general problem with docker? Or am I the only one having problems with two volumes from the same host partition added to a container?

(Sam) #5

I have two or more volumes from the same host to containers without problem

(Petr Blavov) #6

And those are named volumes as per “–volume” parameter? And do they reside on the same host partition?

(Sam) #7

Yes uses -v , both on same logical volume on Ubuntu host. One is /opt/something and the other is in the current users home folder tree.

Both are read inside the container, but not written to

(Petr Blavov) #8

Thanks for confirming that. I’ve now managed to get another container (not jira-software, but alpine) running with both volumes visible as well. So the problem must lie in the jira container itself.

(Petr Blavov) #9

Well, with cptactionhank/atlassian-jira-software, it still dosn’t work. I’ve noticed that the image creates two automatic volumes itself:

VOLUME ["/var/atlassian/jira", “/opt/atlassian/jira/logs”]

Could this be the reason I cannot find the second of my two volumes listed in the command line (no matter which one comes second)? How can I get the container to stop doing that so I can actually save my configuration?