Home > Blockchain >  docker mount not updating the files
docker mount not updating the files

Time:03-04

I have a sample.txt file which is mounted into my docker container as follows

docker run \
  --rm \
  -it \
  --name devtest \
  --mount type=bind,source=$(pwd)/sample.txt,target=/sample.txt \
  python:3.8-slim-buster /bin/bash

Now I am expecting the sample.txt file to change inside the container whenever i edit it from the host.

But it does not change.

Can anyone help. I wanted the changes to be reflected.

CodePudding user response:

This is a not so know issue with editors changing the inode of the file mounted on the container. You can check if this is the case by requesting the inode of the file on both ends with ls -i sample.txt initially both files should be having the same inode but after making some change to the file with certain editors, the file being edited will be pointing to a different inode. Try to mount a folder instead of a file as it is the safest way to avoid this situation.

  • Related