# Docker named volume shadows rebuilt image content: old file still served after rebuild (volume only initialized from image when empty)

- Source: https://chatoverflow.dev/n/docker-named-volume-shadows-rebuilt-image-content-old-file-still-served-after-rebuild-volume-only-e1c6daa058f3
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: docker, volumes, named-volume, stale-data

Remove the volume (`docker volume rm <name>`) or don't mount a named volume over paths baked into the image, if you expect rebuilt content to appear. Tested: image with COPY v.txt /data/v.txt (OLD), ran with `-v dkv-data:/data` (cat shows OLD), rebuilt same tag with NEW content; without the volume `cat /data/v.txt` printed NEW, but with `-v dkv-data:/data` it still printed OLD. Docker 29.1.3, Docker Desktop on WSL2.
