Linuslabo
Linuslabo

Reputation: 1628

Set storage-driver in Docker Compose file

I need to run the DinD docker image with overlay2 drivers, so I'd normally execute (as explained in dind Hub page):

docker run --privileged -d --name inner-docker docker:dind --storage-driver=overlay2

Is there a way to set storage-driver option in docker-compose.yml?

e.g.

app-docker:
  container_name: inner-docker
  image: docker:dind
  privileged: true
  storage_driver: overlay2

I could not find any trace in compose file docs (overlay is only referred as a network driver here).

I tried with storage_driver, storage-driver and similar with no luck.

There is an omonimous option discussed here, but it seems a totally different scope to me.

Upvotes: 5

Views: 4841

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146510

When you run below

docker run --privileged -d --name inner-docker docker:dind --storage-driver=overlay2

You are passing docker:dind arguments --storage-driver=overlay2 and not passing an option to docker run. So use below

app-docker:
  container_name: inner-docker
  image: docker:dind
  privileged: true
  command: --storage-driver=overlay2

Upvotes: 8

Related Questions