Docker Community Forums

Share and learn in the Docker community.

Creating volume for a single file in docker-compose.yml

docker

(Ganeshprakhya2) #1

Hi all,

Apologies if it is duplicate question, I did my fair bit of search and couldn’t find any answer.

I know that we can create a volume to a single file using docker run command with absolute path to the file. Is there a way I can do the same using docker-compose.yml? My requirement is to be able to create multiple volumes for files not folders.

My Docker and Composer versions:

[root@centos71 ~]# docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:23:11 2016
OS/Arch: linux/amd64

Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:23:11 2016
OS/Arch: linux/amd64
[root@centos71 ~]# docker-compose version
docker-compose version 1.8.0-rc2, build c72c966
docker-py version: 1.9.0-rc2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

Thanks & Regards,
Ganesh


(Ganeshprakhya2) #2

Alright, I figured it out. Looks like I was using older version of Compose. I used recent version of compose and it worked. Thanks.