Minimal Arch Linux image with gosu and non-root user
4.9K
Docker build for a basic Arch Linux docker image with gosu.
This image is built from scratch.
This docker image is built from scratch with a somewhat minimal Arch Linux installation containing systemd.
It provides several key features:
nobody for executing programs inside the container.sudo.gosu to execute binaries as different user forwarding container signals.nobody.UNAME and GNAME to make use of the user settings from within scripts.For example:
docker run --rm marcelhuberfoo/arch env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=935562be7aff
TERM=xterm
UNAME=nobody
GNAME=nobody
HOME=/root
This image provides a user and group nobody to run programs as user nobody. It is best used with gosu, as it allows to handle signals of the started process properly within the container.
If you map in a volume, permissions on the host folder must allow user or group nobody to write to it. You can add yourself to the nobody group.
Add yourself to the nobody group:
gpasswd --add myself nobody
Set group permissions to the entire project directory:
chmod -R g+w /tmp/my-data
chgrp -R nobody /tmp/my-data
Enabled services would be started in your container if run with something like:
docker run --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /sys/devices:/sys/devices \
-v /lib/modules:/lib/modules:ro \
--device /dev/usb \
--entrypoint /lib/systemd/systemd marcelhuberfoo/arch
To stop the container, you could execute docker exec -ti <containerid> systemctl poweroff.
Content type
Image
Digest
sha256:49958194a…
Size
182.2 MB
Last updated
about 7 years ago
docker pull marcelhuberfoo/arch