middleware icon indicating copy to clipboard operation
middleware copied to clipboard

Local file changes not persisted after container restart with docker-compose watch in `dev.sh`

Open adnanhashmi09 opened this issue 9 months ago • 0 comments

Description

When using dev.sh watching local file changes, the changes are not reflected in the container after restarting it. This issue occurs specifically with the watch command in the development CLI.

Steps to Reproduce

  1. Start the development environment with dev.sh.
  2. Make some changes in the local version of the code which is being watched by dev.sh
  3. Restart the container by quitting dev.sh and then restarting it
  4. The changes made to the local files are not reflected in the container.

Expected Behavior

When restarting the container, the changes made to the local files should be automatically reflected in the container's filesystem.

Actual Behavior

The local file changes are not synced or persisted in the container's filesystem after restarting the container. The file needs to be saved again by hitting Ctrl - S on your text editor for the watch command to sync again.

Additional Context

  • This issue occurs specifically when using the watch command in the development CLI, which is intended to sync local file changes to the container in real-time.
  • The problem seems to be related to the way Docker handles volume mounts and file synchronization when restarting containers.
  • This problem also seems to be macOS related as on linux machines, docker rebuilds the image to sync for local file changes.

adnanhashmi09 avatar May 14 '24 02:05 adnanhashmi09