Skip to content

Instantly share code, notes, and snippets.

@rwese
Created May 29, 2022 13:22
Show Gist options
  • Save rwese/f345ebba4136542d5d0c735686668155 to your computer and use it in GitHub Desktop.
Save rwese/f345ebba4136542d5d0c735686668155 to your computer and use it in GitHub Desktop.
saneimage -L inside docker container
# ATTENTION: this is not secure and must not be used in any production environment
#
# to work it needs the following extra mappings and permissions
#
# * --net host for the discovery process, which is otherwise blocked by certain iptables rules, at least in my case this was the easiest solution
# * --privileged to access the devices at all
# * dbus bind-mounts for the devices discovered by the os
#
# build the debian-sane image
export DOCKER_IMAGE_NAME=debian-sane
docker build -t "${DOCKER_IMAGE_NAME}" - <<DOCKERFILE
FROM debian:bookworm-slim
RUN apt update -y && apt install -y sane-utils
DOCKERFILE
# attempt search
docker run \
--net host \
--privileged \
-v /var/run/dbus:/var/run/dbus \
-v /dev/bus/usb:/dev/bus/usb \
--rm -it "${DOCKER_IMAGE_NAME}" scanimage -L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment