I thought changes to containers were not persisted after they restarted unless using mounted volumes. However when I create a container:
podman run -d -p 8200:80 --name test nginx
And change the content (using powershell, running in root mode):
Set-Content -Path index.html -Value "<html><body><h1>Changed</h1></body</html>"
wsl -d podman-machine-default -u root enterns podman cp index.html test:/usr/share/nginx/html
I see the updated content at http://localhost:8200
. If I stop and start the container
and refresh the page:
podman stop test
podman start test
The file is still updated. Apparently I have another issue in that I get an empty response after restarting the podman machine, but I can still tell the file is updated by getting a shell using podman exec -it test bash
and checking the file with cat /usr/share/nginx/html/index.html
.
I thought that changes to files in containers wouldn’t persist after restarting. Is there documentation somewhere describing exactly how it works? Can I rely on this, say if I want to make a lot of changes?