gonb icon indicating copy to clipboard operation
gonb copied to clipboard

check_and_run_autostart.sh should allow execution of autostart.sh even if it's not mounted

Open paololazzari opened this issue 1 year ago • 7 comments

I have a use case where I want to build on top the existing image like this:

FROM janpfeifer/gonb_jupyterlab
ADD script.sh /root/autostart/autostart.sh
RUN chmod +x /root/autostart/autostart.sh

and when I run the container I see:

/root/autostart/autostart.sh doesn't seem to be mounted readonly, NOT EXECUTING IT.

paololazzari avatar Mar 04 '25 15:03 paololazzari

What if you simply make the file read only in addition to making it executable?

oderwat avatar Mar 04 '25 15:03 oderwat

How do you suggest I do that @oderwat ?

paololazzari avatar Mar 04 '25 16:03 paololazzari

RUN chmod 500 /root/autostart/autostart.sh instead of the RUN chmod +x /root/autostart/autostart.sh

oderwat avatar Mar 04 '25 16:03 oderwat

That still results in:

/root/autostart/autostart.sh doesn't seem to be mounted readonly, NOT EXECUTING IT.

paololazzari avatar Mar 04 '25 16:03 paololazzari

I think I remember that I was not agreeing with having the check enforcing it to be "mounted read only". There must be some issue with that. But anyway:

Thus is what happens: https://github.com/janpfeifer/gonb/blob/main/cmd/check_and_run_autostart.sh

I guess you need to replace that check.

COPY cmd/check_and_run_autostart.sh /usr/local/bin/

ENTRYPOINT ["tini", "-g", "--", "/usr/local/bin/check_and_run_autostart.sh"]

So you need to either replace the check or change the entry point of your new container.

oderwat avatar Mar 04 '25 16:03 oderwat

Here is the old discussion: #147

oderwat avatar Mar 04 '25 16:03 oderwat

Apologies on the delay following up, I'm on vacation and not online very often.

@paololazzari : I'm no Docker expert, but would it work adding your script.sh to your docker and change the ENTRYPOINT to execute it instead, and then execute JupyterLab ?

The readonly requirement was for security (? it's arguable how much it gains, but again since I'm no Docker expert, I try to always err on the least permissions side).

ps.: To run JupyterLab (from check_and_run_autostart.sh):

# Run JupyterLab from $NOTEBOOKS as user $NB_USER.
su -l "${NB_USER}" -c "cd \"${NOTEBOOKS}\" ; jupyter lab"

janpfeifer avatar Mar 12 '25 07:03 janpfeifer