0

I need to run Docker Rootless on an Alpine Linux 3.19.0 instance. I have followed the instructions of this blogpost in order to create a basic setup with an user named dev. I wish to configure it as an rc-service so as to keep the Rootless Docker service constantly running under the hood.

However, the script setup on the blog post has an apparent problem with the $PATH variable (I imagine the problem is there, although I do not know Linux that much) in which trying to run this service:

#!/sbin/openrc-run name=$RC_SVCNAME description="Docker Application Container Engine (Rootless)" supervisor="supervise-daemon" command="/home/dev/bin/dockerd-rootless.sh" command_args="" command_user="dev" supervise_daemon_args=" -e PATH=\"/home/dev/bin:/sbin:/usr/sbin:$PATH\" -e HOME=\"/home/<USER>\" -e XDG_RUNTIME_DIR=\"/home/dev/.docker/run\"" reload() { ebegin "Reloading $RC_SVCNAME" /bin/kill -s HUP \$MAINPID eend $? } 

while using these variables in /home/dev/.profile:

export XDG_RUNTIME_DIR="$HOME/.docker/run" export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock export PATH="/home/dev/bin:/sbin:/usr/sbin:$PATH" 

returns this very long error which I do not know the cause of:

/lib/rc/sh/openrc-run.sh: /etc/init.d/docker-rootless: line 9: supervise-daemon-args= -e "/home/dev/bin:/sbin:/usr/sbin:/lib/rc/sbin:/lib/rc/bin:/bin:/sbin:/bin:/sbin:/usr/shbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" -e "/home/dev" =e "home/dev/.docker/run": not found 

If anyone could help me to realize where the error is I would be very thankful.

1 Answer 1

0

Not sure if you've figured this out by now, but I'm commenting just in case somebody else is trying to figure this out in the future... this is the kind of stuff that drives me crazy with Linux. There are so many different ways for things to break that until you actually fully understand your distro, your init system, your desktop manager, your desktop environment, your package manager, your user management system etc etc etc, it's really hard to do anything just by intuition with confidence.

I had problems with those directions because I have Sway installed and elogind managing my XDG_RUNTIME_DIR - so everywhere in that guy's tutorials that he talks about setting those variables, they need to be changed.

So... (with username replaced where needed)

supervise_daemon_args=" -e PATH=\"/home/dev/bin:/sbin:/usr/sbin:$PATH\" -e HOME=\"/home/<USER>\" -e XDG_RUNTIME_DIR=\"/home/dev/.docker/run\"" 

Became

supervise_daemon_args=" -e PATH=\"/home/dev/bin:/sbin:/usr/sbin:$PATH\" -e HOME=\"/home/<USER>\" -e XDG_RUNTIME_DIR=\"/run/user/1000\"" 

Then I deleted the first line from the .profile

1
  • Consider using \$PATH instead of $PATH. Commented Feb 17 at 5:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.