Docker – Constant file writes on mounted volume

I have a docker container running in Azure, I have a mounted volume connected to a Azure storage account.

This works perfectly however after receiving the first invoice it seems like there’s a massive amount of writes going through generating a large cost.

I’m seeing two types of operations, one then the other every 5-10 seconds the entire time the container is online.

A sample of these from the storage logs are below with some more detail here:

[
  {
    "time":"2021-04-08T16:00:00.4830041Z",
    "category":"StorageWrite",
    "operationName":"Close",
    "properties":{
      "serviceType":"file",
      "smbCommandMinor":"DirectoryClose",
      "smbCommandDetail":"Detail=Client"
    }
  },
  {
    "time":"2021-04-08T16:00:05.4815059Z",
    "category":"StorageWrite",
    "operationName":"Create",
    "properties":{
      "serviceType":"file",
      "smbCommandMinor":"DirectoryOpen"
    }
  }
]

These writes seem to somehow be generated from my docker container, I don’t understand how.
I was initially using the mounted volume to share files between multiple containers, however even after switching the share location to one not on the mounted volume, these constant writes continue.

My docker image uses node:14-alpine & express, it has puppeteer, chromium, libreoffice and pm2 installed, I can’t see any of these using the storage like this.

My Dockerfile is below in case that offers an answer:

FROM node:14-alpine

WORKDIR /tmp

RUN apk update && apk add --no-cache nmap dpkg bash && 
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && 
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && 
    apk update && 
    apk add --no-cache 
      chromium 
      harfbuzz 
      "freetype>2.8" 
      ttf-freefont 
      nss

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

WORKDIR /usr/app

COPY --chown=node:node installs installs

RUN dpkg --add-architecture amd64

RUN dpkg -i /usr/app/installs/libre/DEBS/*.deb

RUN rm -rf installs

COPY --chown=node:node ./app/package.json .

RUN rm -rf node_modules

RUN mkdir /home/templates 
    && mkdir /home/public 
    && chown -R node:node /home/templates 
    && chown -R node:node /home/public

RUN npm i puppeteer 
    # Add user so we don't need --no-sandbox.
    # same layer as npm install to keep re-chowned files from using up several hundred MBs more space
    && addgroup -S pptruser && adduser -S -D pptruser 
    && adduser pptruser pptruser 
    && adduser pptruser audio 
    && adduser pptruser video 
    && mkdir -p /home/pptruser/Downloads 
    && chown -R pptruser:pptruser /home/pptruser

RUN npm install --arch=x64 --platform=linux sharp

RUN npm i --only=prod --quiet

COPY --chown=node:node ./app .

RUN npm install pm2 -g

USER node

CMD ["pm2-runtime", "./bin/www"]

Is there any way to monitor what process is making these writes? Or disable them?

Source: Docker Questions

LEAVE A COMMENT