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

using supervisor in x11docker showing permission denied. #499

Open
eshk12 opened this issue Apr 5, 2023 · 1 comment
Open

using supervisor in x11docker showing permission denied. #499

eshk12 opened this issue Apr 5, 2023 · 1 comment
Labels

Comments

@eshk12
Copy link

eshk12 commented Apr 5, 2023

Hello,
I have a script that I want to run a script when the container starts without freezing the container, so I am using the supervisor tool.

This is my docker file:


FROM x11docker/xfce

WORKDIR /data

RUN apt-get update && apt-get install -y \
    xvfb \
    python3 \
    python3-pip \
    supervisor


COPY startup.sh /usr/local/bin/startup.sh
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN chmod +x /usr/local/bin/startup.sh
CMD ["/usr/bin/supervisord", "-n"]

supervisord.conf

[program:startup]
command=bash -c "/usr/local/bin/startup.sh"
autostart=true
autorestart=true
startretries=3

And i am trying to run this using this command: x11docker <imagename> --home -xorg

But I am getting this error:

root@ubuntu:~/x11mati# x11docker x11mati --home --xorg
x11docker note: Option --xc for X in container enabled automatically.

x11docker WARNING: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it looks like x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: New X server --xorg :101 will run on tty 8.
  Access it with [CTRL][ALT][F8].

x11docker note: Option --xorg: x11docker assumes that you need
  a window manager. If you don't want this, run with option --desktop.
  Enabling option --wm to provide a window manager.

x11docker note: Options --xorg --xc: Running Xorg in container is experimental
  and might misbehave, fail or crash.
  Please report issues at https://github.com/mviereck/x11docker

x11docker WARNING: x11docker will run Xorg as root.

x11docker note: Option --network=none is set to disable network access.
  If you need network and internet access, set option -I, --network [=NET].

Traceback (most recent call last):
  File "/usr/bin/supervisord", line 33, in <module>
    sys.exit(load_entry_point('supervisor==4.2.2', 'console_scripts', 'supervisord')())
  File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 359, in main
    go(options)
  File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 369, in go
    d.main()
  File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 72, in main
    self.options.make_logger()
  File "/usr/lib/python3/dist-packages/supervisor/options.py", line 1494, in make_logger
    loggers.handle_file(
  File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 419, in handle_file
    handler = RotatingFileHandler(filename, 'a', maxbytes, backups)
  File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 213, in __init__
    FileHandler.__init__(self, filename, mode)
  File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 160, in __init__
    self.stream = open(filename, mode)
PermissionError: [Errno 13] Permission denied: '/var/log/supervisor/supervisord.log'

I am running this command using root access, what am I missing here?

@mviereck
Copy link
Owner

You are running x11docker as root, but x11docker sets up an unprivileged container user nonetheless.
So your supervisor cannot write to /var/log.
If you are fine with root for all container commands, you could use root in container, too, with --user=root.
If you prefer an unprivileged container for commands other than the supervisor, I'll have a look again.

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

No branches or pull requests

2 participants