Develop in Docker I: Virtualbox file syncing bug
Docker is a great tool for deployment. And I want to develop my Flask app in Docker so that I can get the same environments as the production environments.
Bug description
But I went into this bug:
- When I first mount a directory into a container, everything works fine.
- After I change some code, the container aborted with a syntax error.
- Then I attach into the container and see what happened.
- When I use
vim
to open the "syntax error" file, everything seems to be fine. - When I use
cat
to get the file content. Then change I made to this file appeared at the end of this file instead of the place I wanted it to be.
- When I use
After some search, it seems to be a virtualbox bug:
But this bug may not appear on everyone's machine. At least in this post1, the speaker can get the file syncing correctly, I don't know if this is due to she didn't do any deletion. (If you are also interested in developing in Docker, you should read this post too)