Skip to content

Instantly share code, notes, and snippets.

Last active Nov 8, 2018
What would you like to do?
pdftk CLI for ubuntu 18.04 or later in docker replacement
# Build or use cached image and tag with "local/local/ubuntu_pdftk", suppress output
# to maintain compatibility in case you are parsing the pdftk output.
# It will build the image if it's absent or use the cached one.
echo "FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y pdftk && \
rm -rf /var/lib/apt/lists/*" | docker build -t local/local/ubuntu_pdftk - 2>&1 > /dev/null
# Run the pdftk
set -eu
docker run --name pdftk -it --rm --user $(id -u):$(id -g) -v "$PWD:/workdir$PWD" -w "/workdir$PWD" local/local/ubuntu_pdftk pdftk "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment