4

I know that when using Docker Desktop on Windows or macOS, there are performance penalties when using bind mounts in containers and volumes are preferred for performance. However, I can't find any information about any penalties when running Docker on Linux.

Are there performance penalties when using bind mounts on Docker on Linux or are there none since Docker runs natively on Linux?

1
  • Bind-mounts exist on Linux independently of Docker (they are a way to have the equivalent of a hard-link to a directory). AFAIK volumes are recommended as allowing a better management of the data, and I don't remember seeing them recommended for performance on Linux, so bind-mounts are likely just as fast if not faster.
    – xenoid
    Apr 16, 2020 at 8:12

1 Answer 1

4

No, there are no penalties on linux.

From https://docs.docker.com/docker-for-mac/osxfs-caching/

On Linux, these guarantees carry no overhead, since the underlying VFS is shared directly between host and container.

In that article, you can read more about why those performance hits occur and how docker tries to deal with them on macOS


Also percona did a test: https://www.percona.com/blog/2016/02/11/measuring-docker-io-overhead/

So I can confidently say there is NO IO overhead for any docker data volume pattern described above.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.