From 3049a10757c4e3fcca93a60585fcf1ddc8a14772 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 26 Feb 2025 02:30:25 +0100 Subject: [PATCH] doc: Update docker.rst to explain how to use with podman I've fiddled/struggled with this by myself, by getting a permission error like this one: ```shell OutputFileAccessError: Output file location (./output.pdf) is not a writable file. ``` I've loosely followed and found https://github.com/containers/podlet?tab=readme-ov-file#in-a-container and explained the required flags in a similar way, but adapted for this tool (it likely won't be used so much on system files). I've tested it and it works fine for me. The same issue may be on Docker rootless, but I guess people will get that and I cannot test it here. --- docs/docker.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/docker.rst b/docs/docker.rst index e55d2dcc..eb4f8f91 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -115,6 +115,15 @@ Docker volume: alias docker_ocrmypdf='docker run --rm -i --user "$(id -u):$(id -g)" --workdir /data -v "$PWD:/data" ocrmypdf' docker_ocrmypdf /data/input.pdf /data/output.pdf +Especially if you use `Podman `__ (or have SELinux enabled on your system), you may need to add ``--userns keep-id`` there, otherwise you may get access errors, because the user is otherwise not mapped to the same UID as on the host: + +.. code-block:: bash + + alias podman_ocrmypdf='podman run --rm -i --user "$(id -u):$(id -g)" --userns keep-id --workdir /data -v "$PWD:/data" ocrmypdf' + podman_ocrmypdf /data/input.pdf /data/output.pdf + +If you use SELinux you may additionally need to add the ``:Z`` `suffix to the volume `__ or disable SELinux for the container using ``--security-opt label=disable``, which is suggested for system files as they should not be re-labelled. Please refer to the „Note” section at the end of the linked podman documentation for details. + .. _docker-lang-packs: Adding languages to the Docker image