Docker Community Forums

Share and learn in the Docker community.

How would you loosely couple an external volume to a container in Docker 1.7.1?

(Davidmichaelkarr) #1

I’m somewhat familiar with the features in the latest version of Docker, but I’m finding I have to do a little bit of Docker archaeology to determine what problems I might have in a situation where I’m forced to use an old version of Docker, specifically version 1.7.1.

Reading through the CHANGELOG on github, I see that the first mention of anything involving volumes was in version 1.9.0. If someone was using 1.7.1, how difficult would it be to configure a running container with an external volume, or anything else in that area that is easy to do with newer releases?

(Nathan Le Claire) #2

I forget the exact version where it appeared but docker volume was absent to manage volumes as a top level construct once upon a time. You had to rely just on -v and --volumes-from. At any rate, -v /path will createa a volume at /path in the container, -v /host:/con will bind mount /host from the host into /con in the container, and --volumes-from will inherit the volumes from another container (allow for sharing). This is what you’re working with without docker volume. (Don’t forget to remove containers with docker rm -v as well or else the “orphaned volumes” will stick around in internal dirs forever).