87

I'm making some docker-compose yml file with this link. In this config, what does driver: local in top-level volumes mean?

volumes: esdata1: driver: local esdata2: driver: local 
1
  • 4
    it seems local is the default driver, so it's redundant to specify it here Commented Sep 10, 2019 at 13:26

1 Answer 1

91

It's volume driver, equivalent to

docker volume create --driver local --name esdata1 docker volume create --driver local --name esdata2 

local means the volumes esdata1 and esdata2 are created on the same Docker host where you run your container. By using other Volume plugins, e.g.,

--driver=flocker 

you are able to create a volume on a external host and mount it to the local host, say, /data-path. So, when your container writes to /data-path, it actually writes to a external disk via network.

Refer here for some sort of Volume plugins available

Sign up to request clarification or add additional context in comments.

3 Comments

does local refer to the directory where the docker-compose.yml file defining the volume lies, or some other default local directory? When I run docker-compose up, I don't see any local volumes or anything named esdata1 or esdata2. What am I missing here?
@topher217 When you install docker on your system it comes with a "docker root directory", and it's where containers, images or volumes normally stay. One way to see the volume details is to use docker volume ls and docker volume inspect
@topher217 'local' means it is created on your host, e.g. where you have your Docker Dektop runs. To understand it would be useful so see kind of autocompletion which other options exists. As per docker docs 'local' is a plugin. Other than that you can see the volume in Docker Desktop under Volumes named with the pattern <yourcontainername>_<yourvolumename>. You can backup the volumes if you create an account at docker and login. So kind of tracking users because otherwise why would i need to login to backup my local volumes locally?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.