From 53270b8eb110e9763fa45fbc9e22b3386e98a459 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 26 Feb 2025 02:43:46 +0100 Subject: [PATCH 1/2] Doc: Update docker.rst to use I prefer to write the name in full aka `jbarlow83/ocrmypdf-alpine` and I'd also suggest to document this because: * if you use `docker tag` this AFAIK only tags the currently downloaded (=pulled) version of that image * in case a new update comes out, the new one will not be pulled automatically and one would have to pull and tag the image locally, again * This `docker tag` command is easily overlooked, if users just run `docker run ocrmypdf` this may or may not work, depending on how it is resolved. Also, AFAIK if one could get Docker to register https://hub.docker.com/ocrmypdf then this would suddenly be used instead of your image (currently `podman pull docker.io/ocrmypdf` returns a 404 for me, though) * It is more common to write at least the user namespace there and the project, to prevent such errors. Also, default [Docker has many shortcuts for this and e.g. assumes Docker-Hub is always being used](https://stackoverflow.com/questions/37861791/how-are-docker-image-names-parsed). Podman usually does not, that's why I personally prefer to use the very full and clear `docker.io/jbarlow83/ocrmypdf-alpine:latest` e.g. for alpine. This makes it not only clear which version is used, but also where it is pulled from (should one have configured different Docker registries). --- docs/docker.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/docker.rst b/docs/docker.rst index eb4f8f91..82930fd7 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -87,8 +87,7 @@ To start a Docker container (instance of the image): .. code-block:: bash - docker tag jbarlow83/ocrmypdf-alpine ocrmypdf - docker run --rm -i ocrmypdf (... all other arguments here...) - - + docker run --rm -i jbarlow83/ocrmypdf-alpine (... all other arguments here...) - - For convenience, create a shell alias to hide the Docker command. It is easier to send the input file as stdin and read the output from @@ -96,7 +95,7 @@ stdout – **this avoids the messy permission issues with Docker entirely**. .. code-block:: bash - alias docker_ocrmypdf='docker run --rm -i ocrmypdf' + alias docker_ocrmypdf='docker run --rm -i jbarlow83/ocrmypdf-alpine' docker_ocrmypdf --version # runs docker version docker_ocrmypdf - - output.pdf @@ -104,7 +103,7 @@ Or in the wonderful `fish shell `__: .. code-block:: fish - alias docker_ocrmypdf 'docker run --rm ocrmypdf' + alias docker_ocrmypdf 'docker run --rm jbarlow83/ocrmypdf-alpine' funcsave docker_ocrmypdf Alternately, you could mount the local current working directory as a @@ -112,14 +111,14 @@ Docker volume: .. code-block:: bash - alias docker_ocrmypdf='docker run --rm -i --user "$(id -u):$(id -g)" --workdir /data -v "$PWD:/data" ocrmypdf' + alias docker_ocrmypdf='docker run --rm -i --user "$(id -u):$(id -g)" --workdir /data -v "$PWD:/data" jbarlow83/ocrmypdf-alpine' 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' + alias podman_ocrmypdf='podman run --rm -i --user "$(id -u):$(id -g)" --userns keep-id --workdir /data -v "$PWD:/data" jbarlow83/ocrmypdf-alpine' 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. From 71991ad09bd5fd3bd085f9ac86a079c591d0feba Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Wed, 26 Feb 2025 14:58:43 -0800 Subject: [PATCH 2/2] Remove podman --- docs/docker.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/docker.rst b/docs/docker.rst index 82930fd7..6adf3572 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -114,15 +114,6 @@ Docker volume: alias docker_ocrmypdf='docker run --rm -i --user "$(id -u):$(id -g)" --workdir /data -v "$PWD:/data" jbarlow83/ocrmypdf-alpine' 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" jbarlow83/ocrmypdf-alpine' - 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