3

According to the official docs, MongoDB with WiredTiger is supposed to be run on Linux with the XFS filesystem. Yet, the official docker image for mongo uses ext4, which means that we get a warning whenever we boot up a container:

Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem"

So why is it that the official docker image does not use XFS? Is this a concern of negligible importance?

5
  • 9
    Because docker images aren't VMs. They don't use their own filesystem but instead the host's FS.
    – AlexD
    Feb 9 at 15:05
  • @AlexD Really? When I run the mongo container on my mac (which uses APFS), the filesystem within the (Ubuntu) container reads as ext4
    – Magnus
    Feb 9 at 17:35
  • 7
    Docker on Mac launches containers within a virtual machine which runs Linux.
    – AlexD
    Feb 9 at 17:50
  • @AlexD OK, thanks for the info
    – Magnus
    Feb 9 at 18:14
  • 1
    That is an informational message that if you are using containers in this and other typical configurations, the performance could be twice as fast when using xfs.
    – Greg Askew
    Feb 10 at 11:21

1 Answer 1

17

The full answer.

A docker image doesn't have a file system. A docker image is a bunch of tar files each representing a layer plus some JSON files with the image metadata. When a docker image is pulled into a host these files are unpacked into the host file system, usually under /var/lib/docker. When a docker container starts, these layers are mounted inside the container using OverlayFS, a union FS which allows combining different filesystem sub-directories with different image layers into a single virtual filesystem. If there are volumes then they are bind-mounted and within a container, you would see them as the original filesystem that the host has /var/lib/docker on (unless tmpfs is used).

Consequentially, it is outside of the control of the image authors which FS it is going to run on. If you want to use a specific filesystem like XFS from within the container then either run it on a system which uses this FS for /var/lib/docker or bind-mount a separate FS into the container. Won't work on Mac or Windows as Docker Desktop on these systems uses an internal VM to run containers and I don't think it is possible to modify this VM's FS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .