- action: sync
path: .
target: /code
redis:
image: "redis:alpine"
```
Whenever a file is changed, Compose syncs the file to the corresponding location under `/code` inside the container. Once copied, the bundler updates the running application without a restart.
For more information on how Compose Watch works, see [Use Compose Watch](/manuals/compose/how-tos/file-watch.md). Alternatively, see [Manage data in containers](/manuals/engine/storage/volumes.md) for other options.
> [!NOTE]
>
> For this example to work, the `--debug` option is added to the `Dockerfile`. The `--debug` option in Flask enables automatic code reload, making it possible to work on the backend API without the need to restart or rebuild the container.
> After changing the `.py` file, subsequent API calls will use the new code, but the browser UI will not automatically refresh in this small example. Most frontend development servers include native live reload support that works with Compose.
## Step 5: Re-build and run the app with Compose
From your project directory, type `docker compose watch` or `docker compose up --watch` to build and launch the app and start the file watch mode.
```console
$ docker compose watch
[+] Running 2/2
✔ Container docs-redis-1 Created 0.0s
✔ Container docs-web-1 Recreated 0.1s
Attaching to redis-1, web-1
⦿ watch enabled
...
```
Check the `Hello World` message in a web browser again, and refresh to see the
count increment.
## Step 6: Update the application
To see Compose Watch in action:
1. Change the greeting in `app.py` and save it. For example, change the `Hello World!`
message to `Hello from Docker!`:
```python
return f'Hello from Docker! I have been seen {count} times.\n'
```
2. Refresh the app in your browser. The greeting should be updated, and the
counter should still be incrementing.