HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Scanning fs in a Docker container is (much) slower than on host?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
muchcontainerdockerthanslowerhostscanning

Problem

Is scanning/searching the filesystem slower in a Docker container, than on the host? Seems a lot slower from my testing and sometimes I get an EIO scan error.

Specifically I am scanning a read-only (:ro) shared volume.

In this case, the workaround is I can the host first before sharing the volume in the container, it seems much faster.

Any other workarounds? Is my observation imagined or real?

I am running Docker version 18.03.1-ce, build 9ee9f40

on MacOS Sierra

Solution

Docker on MacOS runs on a virtual machine (docker-machine), and it's known that docker-machine volume mounts may perform worse than what you'd expect. It becomes worse especially when it comes operations concerning lots of small files, like scanning the filesystem.

Official Docker documentation also mentions this, and suggests some workarounds by lowering the consistency guarantees.

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

Context

StackExchange DevOps Q#4131, answer score: 3

Revisions (0)

No revisions yet.