Docker Community Forums

Share and learn in the Docker community.

Moving /var/lib/docker to Amazon EFS

Hi folks,

I’m running docker on an EC2 instance, and want to move my /var/lib/docker directory to a mounted AWS EFS directory. (don’t have to guess size needed like EBS, pay only for what’s used, backups easier, can share mount between instances, etc)

I know the trick about moving the directory and symlink’ing from old location to new, and that works fine when moving to another EBS device, but it doesn’t work for EFS, because of a single file: /var/lib/docker/overlay2/backingFsBlockDev. This is a special block device file, and apparently EFS doesn’t support those.

I tried moving everything except backingFsBlockDev (i.e. leave that on EBS and symlink from the EFS location to the EBS location; EFS does support symlinks), but Docker fails to start, something about an overlay test failing. Even tried using a bind-mount rather than a symlink, but same result.

Next thought was to find the setting that says where backingFsBlockDev is, again so I can point to that one file remaining somewhere on the EBS drive. But there doesn’t seem to be such a setting; at least not that’s easy to find.

Does anyone know where the constant “/var/lib/docker/overlay2/backingFsBlockDev” is stored? Or any other tricks that would allow /var/lib/docker to be moved over to a filesystem that doesn’t support block device files?