Docker Community Forums

Share and learn in the Docker community.

Docker-compose loses mount binds after a week

Hi All, I hope it’s not a duplicate (I tried searching but nothing relevant came up).

So I have 2 container apps running in the same deployment for docker compose. They share the same host dir to exchange files (here is a config snipper from compose yaml)

services:
  srv1:
    volumes:
      - /some/host/dir:/tmp/storage

  web:
    image: nginx
    ports:
      - 80:80
    volumes:
      - /some/host/dir:/usr/share/nginx/html:ro

What’s happening is that after a week or so that volume suddenly is unmounted, so that the software in my first container says

2021-10-14T10:52:11.405085366Z [Error: ENOENT: no such file or directory, mkdtemp '/tmp/storage/XXXXXX'] {
2021-10-14T10:52:11.405105331Z   errno: -2,
2021-10-14T10:52:11.405124738Z   code: 'ENOENT',
2021-10-14T10:52:11.405143881Z   syscall: 'mkdtemp',
2021-10-14T10:52:11.405163414Z   path: '/tmp/storage/XXXXXX'

Has anybody have any ideas what can be done here to troubleshoot further?

Thank you in advance,
Philipp

Is this folder or a parent folder a mount target? If the answer is yes, then it is highly like due to bind propagation.

Hi @meyay, thank you for your time looking into the issue.

Are you asking about container folder /tmp/storage or host folder /some/host/dir? Sorry it’s not quite clear from your respond. But if it’s a host folder, aren’t all of them mountable at the end of the day?

@meyay
And a follow up question, if you allow: would be the potential issue with bind propagation eliminated if I move to docker volumes instead of bind mounts?

Thx

I see how this can be ambigous. I am refering the left hand side, the host side, of your bind-mount volume.

Depends wether mount propagation causes the issue or not.

No, it’s taken from /home/storage which is not mountable based on fstab & mount information. One other thing I’m considering is to maybe move it from /tmp in a container to some other folder to avoid possible garbage collection.

Any other ideas what to check @meyay?

I can see how /tmp might suffer from garbage collection and how changing the container path to a different path is a good idea :slight_smile:

Appart from that there is nothing that hits the eye. I hope moving the container path will solve it.