-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
container fails to start when using readonly filesystem (20-envsubst-on-templates.sh) #940
Comments
@Squixx Any idea how we can make your changes work with this requirement? |
I'm on vacation right now, so can't check. But seems like it has to with the way nginx converts the template to actual config on boot. I'll take a look when I get back (~17th July) nginxinc/docker-nginx-unprivileged#88 could point that it's an issue with the inner workings of nginx, you could ensure the entire conf file is outside of the container like https://gist.github.com/monosoul/e462b03cba5542bfc52f135417a8209d in the case of Which makes me think we could solve this by only adding specific docs about read only. But again I'm on mobile so have no way to test as of right now. |
muellerst-hg does it work for you with the above gist? |
@Squixx even though 20-envsubst-on-templates.sh entrypoint does its job when applying this gist. The nginx config which is used is a bit different. I am not sure if this an issue. # config fetched from container process using nginx -T
diff -wu /tmp/rw.conf /tmp/ro.conf
--- /tmp/rw.conf 2024-07-23 12:55:26.722236147 +0200
+++ /tmp/ro.conf 2024-07-23 12:55:24.402242094 +0200
@@ -140,7 +140,10 @@
video/x-msvideo avi;
}
-# configuration file /etc/nginx/conf.d/default.conf:
+# configuration file /etc/nginx/conf.d/10-include-tmp.conf:
+include /var/nginx.conf.d/*.conf;
+
+# configuration file /var/nginx.conf.d/default.conf:
server {
listen 8080;
server_name _;
@@ -160,3 +163,49 @@
root /usr/share/nginx/html;
}
}
+# configuration file /etc/nginx/conf.d/default.conf:
+server {
+ listen 8080;
+ server_name localhost;
+
+ #access_log /var/log/nginx/host.access.log main;
+
+ location / {
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+ }
+
+ #error_page 404 /404.html;
+
+ # redirect server error pages to the static page /50x.html
+ #
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/share/nginx/html;
+ }
+
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+ #
+ #location ~ \.php$ {
+ # proxy_pass http://127.0.0.1;
+ #}
+
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+ #
+ #location ~ \.php$ {
+ # root html;
+ # fastcgi_pass 127.0.0.1:9000;
+ # fastcgi_index index.php;
+ # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
+ # include fastcgi_params;
+ #}
+
+ # deny access to .htaccess files, if Apache's document root
+ # concurs with nginx's one
+ #
+ #location ~ /\.ht {
+ # deny all;
+ #}
+}
+
+ Here's the setup I have tested: $ echo "include /var/nginx.conf.d/*.conf;" > include-tmp.conf
$ cat > compose.yml << EOF
version: "3.9"
services:
dtrack-frontend-snapshot:
image: dependencytrack/frontend:snapshot
environment:
- BASE_PATH=http://127.0.0.1:8080
- NGINX_ENVSUBST_OUTPUT_DIR=/var/nginx.conf.d
ports:
- "8080:8080"
read_only: true
volumes:
- type: tmpfs
target: /tmp
- ./include-tmp.conf:/etc/nginx/conf.d/10-include-tmp.conf:ro
tmpfs:
- /var/nginx.conf.d:rw,noexec,nosuid,nodev
EOF IMHO this is a non-intuitive workaround which requires knowledge about implementation details in order to understand what one is doing. |
Yeah i agree, this requires some docker / nginx knowledge to get to run properly... but currently has no alternative unfortunately. @nscuro how do you want to approach this? could we write some docs for this usecase? |
Current Behavior
When mounting the root filesystem with read_only, the entrypoint script
20-envsubst-on-templates.sh
fails to start with the following error:Tested with image: dependencytrack/frontend:snapshot (image id 1b096cd8f5da)
Readonly root filesystem is working fine using image
dependencytrack/frontend:4.11.4
(image id c3d304f8c999)Seems like this was introduced with 4ba0876
Steps to Reproduce
compose-snapshot.yml
with the following content:Expected Behavior
I expect root filesystem with readonly to work as before (in 4.11.4):
compose-4_11_4.yml
with the following content:Dependency-Track Frontend Version
4.12.0-SNAPSHOT
Browser
Mozilla Firefox
Browser Version
127.0.2
Operating System
Linux
Checklist
The text was updated successfully, but these errors were encountered: