2

I have one container which needs a lot of space and I want it to use a dedicated drive on my server.

This answer comprehensively explains how to move docker data-root. But is it possible to have two data-roots and assign a specific container to the second one?

Svante
  • 1,069
  • 3
  • 12
  • 28

1 Answers1

1

You sound like you have specific container-based needs. Thus, moving docker data-root to another location does not seem to be the suited answer here (though you may do it anyway).

What you need are "volumes".
Wrap your image within a docker-compose file, and mount some container directories as volume pointing to some "host" path (outside of docker data-root). They must indeed be the directories that will request a lot of space, and point to a VG or external mounting point (e.g. NFS) with sufficient space !

Eg:

...
my-service:
  image: my-image
  volumes:
  - "/path/within/host/opt/data/tmp/:/path/within/container/cache/:rw"
  - "/path/within/host/opt/data/layers/:/path/within/container/layers/:rw"
  - "/path/within/host/opt/data/logs/:/path/within/container/logs/:rw"

...

(note that "rw" can be omitted here, since it's the default value)

Community
  • 1
  • 1
Marvin
  • 1,650
  • 4
  • 19
  • 41