Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving of simple text not updating in Docker, cached text displayed instead #15

Closed
mihaigalos opened this issue Sep 29, 2020 · 2 comments

Comments

@mihaigalos
Copy link
Contributor

Using webify in docker, I'm seeing cached values for simple text:

script.sh:

#!/bin/sh

echo foo
docker run -d --rm -p 8080:80 -v  $(realpath script.sh):/script beefsack/webify

If I change foo to bar, curl http://localhost:8080 still displays the old value.

This only occurs in Docker, if I run webify on baremetal, the updated value bar is displayed.

@beefsack
Copy link
Owner

Hi @mihaigalos!

Can you output the content of the file running in the container, and check if the file inside the container is updated?

You can do this using something like:

docker exec -it 3d6e55c660a0 cat /script

Sometimes file mounts fail to update in docker containers because some editors use a separate temporary file while editing, then copy it into place once you complete, and Docker won't update the mounted file in the container in cases like this. This is a known issue with Docker and won't be fixed.

One workaround if you want to use a host mount is to mount a directory instead of the file directly. You could do that using something like:

docker run -d --rm -p 8080:80 -v /path/to/script/dir:/mnt -e SCRIPT=/mnt/script.sh beefsack/webify

@mihaigalos
Copy link
Contributor Author

Oh I see.
I use vim which effectively changes the inode because of writing to a separate file and replacing the original, which doesn't reflect in Docker.

Your solution with mounting the whole folder+env var worked - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants