jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

v4.0 doesn't chmod /startapp.sh to executable #74

Closed djaydev closed 2 years ago

djaydev commented 2 years ago

I get these errors at the start of the container. I believe the previous version did a chmod on the startapp.sh? It's probably me doing something wrong, I'll delete this if I just missed something in the Dockerfile Thanks for great builds

10/07/2022 7:29:30 AM
[app         ] /!\ No application to start: /startapp.sh is missing or not executable. /!\
10/07/2022 7:29:31 AM
[supervisor  ] service 'app' exited (with status 5).
10/07/2022 7:29:31 AM
[supervisor  ] restarting service 'app'.
10/07/2022 7:29:31 AM
[supervisor  ] starting service 'app'...
10/07/2022 7:29:31 AM
[app         ] /!\ No application to start: /startapp.sh is missing or not executable. /!\
jlesage commented 2 years ago

Yeah make sure your startapp.sh has execute permission.

Also note that the new v4 images are not 100% backward-compatible, meaning that some adjustments may be needed when going from version 3.

djaydev commented 2 years ago

Ok thank you

djaydev commented 2 years ago

Sorry just want to reopen to discuss. For the most part there wouldn't be a condition where the /startapp.sh isn't used? I was just thinking we could add a script to /etc/cont-init.d to check for executable like if [[ -x "/startapp.sh" ]] else chmod +x ... to ensure? Sometimes where the files are stored on the web, local folders, etc the linux permissions don't stay with the file, and when you do docker build, Dockerfile COPY startapp.sh /startapp.sh container won't start.

Or maybe add to Readme

In Dockerfile:

# Pull base image.
FROM jlesage/baseimage-gui:alpine-3.15-v4

# Install xterm.
RUN add-pkg xterm

# Copy the start script.
COPY startapp.sh /startapp.sh
RUN chmod +x /startapp.sh

# Set the name of the application.
RUN set-cont-env APP_NAME "Xterm"
jlesage commented 2 years ago

Forcing a chmod +x on startapp.sh is something possible, but I'm wondering if it's really needed. Maybe I don't have all the use cases, but usually startapp.sh is in your source tree and if at that point is doesn't have the execute permission, it's probably there the problem should be fixed.

Also, I think the issue is the same as if startapp.sh invokes an app binary that doesn't have execute permission. In that case, we don't expect the baseimage to force execute permission on every possible binaries/scripts.

jlesage commented 2 years ago

And also the idea behind this is to minimize changes done to the content of baseimage itself when running.

djaydev commented 2 years ago

Forcing a chmod +x on startapp.sh is something possible, but I'm wondering if it's really needed.

Sorry I'm not a programmer just asking. If chmod on startapp.sh is not needed, how else do I make it executable? I created the file with text editor and save as startapp.sh but it doesnt work in the container without the chmod. If there's a better way can we add that to the Readme for just plain users.

jlesage commented 2 years ago

Just to clarify, chmod +x on startapp.sh is needed, but it should be done prior the build of the image (and not during runtime).

So in your case:

djaydev commented 2 years ago

Ok thank you again. Just want to let you know I've been using these for years the gui baseimage and none gui one for all kinds of dockerapps I run. Really great stuff, best baseimages I can find, I really couldnt write my own dockers with them.

jlesage commented 2 years ago

You are welcome!