pitfall when using docker file mount

A few days ago I mounted a file in the docker host to a file in a docker container when starting a docker container. However, when I edited the file in the docker host, the file change was not reflected in the file in the container. That surprised me. After searching this issue using google, I find the root cause as below:

https://github.com/moby/moby/issues/15793

This is because docker uses file inode to do file mounting. I used vim to edit the file. This will cause a new file with the same created, but with a new inode. The container still uses the file with the old inode. That is why the file change was not reflected in the container.

A work around to this issue is to use nano to edit the file in the host. nano editor will not create a new file.