-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Weblate cannot start container in docker swarm mode #2816
Comments
There should be a tmpfs mounted there. Do you have it in the compose file? Does it get mounted? |
Yes it it there in the long form.
It's the equivalent of
I tried this form also, but changed because I thought I can set additional parameters with the long form. But tmpfs has none. |
As you don't have the Weblate container with a read-only root, you can skip all those tmpfs volumes, these are only needed in case root is read-only. But still, it is strange that it fails with "Read-only file system". If it was a permission issue, it should fail with "Permission denied". This way it looks like tmpfs is actually not mounted. |
This issue has been marked as a question by a Weblate team member. Why? Because it belongs more to the professional Weblate Care or community Discussions than here. We strive to answer these reasonably fast here, too, but purchasing the support subscription is more responsible and faster for your business. And it makes Weblate stronger as well. Thanks! In case your question is already answered, making a donation is the right way to say thank you! |
You are right. I changed the entrypoint to a sleep and connected to the container with
So for sure there is nothing mounted. And the default content of the image with localtime and nginx having ownership of I'm not 100% sure but I read somewhere that the tmpfs is ignored in docker swarm mode. The reason is, that local mounts, and tmpfs is a special case of that, make no sense in a distributed environment. The recommendation for docker swarm is to use shared mounts based on shared file systems or images. |
Isn't some real volume used instead of tmpfs? The |
I investigated further. When running the container, docker allocates two local volumes for /tmp and /run and mounts them into the container. I guess that is from the volume directives in the weblate Dockerfile. Here is the draft from the docker container inspect output:
As it is the default for local volumes, the content of the container is copied to the volume before mounting. Then the /tmp root directory gets the timestamp of the local volume (/var/lib/docker/volumes/xxxxx/_data) on the file system of the host and the content is the copied content from the container, hence the timestamps of May 3 for localtime and Nov 7 for nginx. As I said, the tmpfs config is ignored in docker swarm. So for me there would be three possible solutions:
|
And here some more investigation to proof my hypothesis. I created a simple Dockerfile with the following content:
The output of running
As expected the /tmp and /run directories of the container images are not clean. |
This can cause problems in some setups and should not be needed as the container expects these to be empty. See WeblateOrg/docker#2816
This can cause issus in some setups as the content is copied, but some permissions seem to be lost. Fixes WeblateOrg#2816
This can cause issus in some setups as the content is copied, but some permissions seem to be lost. Fixes WeblateOrg#2816
I see two major problems with your approach. Temporary filesThe /tmp directory is used for short lived data of users and processes. It usually is managed by the system by some kind of upstart/cron script in a full fledged OS. Such an infrastructure is usually not part of a container image and should not be. If an application has the need for temporary or volatile data according to the Filesystem Hierarchy Standard, Chapter 2, the Run-time variable dataAccording the Exposing this as a volume and mapping it, e.g. to the Also Maybe taking the ConclusionMy investigation with the current image structure of the 8.5 versions show that even if you try to alter the image and breed one of your own, cannot be done. Removing the volumes or content of the directories are forbidden to he docker build because of the read only approach. So I'm a little stuck here on how to use the docker image in a swarm mode context. Do you have any suggestions for me? BTW, gave a minor sponsoring from my company for WeblateOrg to honor your effort. |
This can cause issus in some setups as the content is copied, but some permissions seem to be lost. Fixes WeblateOrg#2816
While I understand your architecture points, the reality is more tricky as Weblate runs many tools internally, and some of them might have The question is whether adding volumes for these as in 384b4de is necessary. These are really only to be used with tmpfs and nothing else. |
The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.
|
1 similar comment
The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.
|
This reverts commit 384b4de. These volumes are only intended to be used as tmpfs, but when adding them as VOLUME in Dockerfile, these will end up as real volumes in the swarm mode. Fixes WeblateOrg#2816
Got that and accept the constraints.
But once again, tmpfs does not work with docker swarm. They are ignored and converted to local volumes and there is no way to go around that, because this is the intended behaviour of the docker daemon in swarm mode. What I understand from this discussion, and let us be transparent and open here, is that you cannot or will not support weblate on docker swarm. Fair enough, that is the decision of the weblate project but should be noted in the documentation that docker swarm is currently not supported. |
The tmpfs is only needed with a read-only file system. So, IMHO the only problem are additional volumes which are not supposed to be used as real volumes. I think #2821 should address the issue by removing the additional volumes. Let's see if the tests pass there and it doesn't break any of the existing expectations. |
Describe the issue
I use the official docker image with a compose file in docker swarm. In this context the container cannot start, due to permissions issues regarding them tmpfs mounts.
I already tried
Steps to reproduce the behavior
docker stack deploy weblate -c compose.yml
docker stack ps weblate
that the weblate container does not come up. The redis and postgres containers however are starting fine.Expected behavior
The container should start and maybe fix the permissions upon start.
Screenshots
No response
Exception traceback
No response
How do you run Weblate?
Other
Weblate versions
Latest 5.8 on docker ce engine version 27.3.1
Weblate deploy checks
No response
Additional context
The docker compose file reference for docker swarm mode (docker stack deploy) is different to the local container (docker compose). In swarm mode there is no way of configuring the uid or gid for the mounted tmpfs file system.
I use the following compose file:
The text was updated successfully, but these errors were encountered: