From da9afcb2429bce62aba0e1e45923e88e332dee12 Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Mon, 18 Nov 2024 11:52:05 +0000 Subject: [PATCH] update container examples in readme --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 53239e7d..6c0458eb 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,50 @@ completions. By default, the manual pages and shell completions are put into the `cargo` target directory, but the exact location is unpredictable. To write the assets to a predictable location, set the environment variable `ASSET_OUT_DIR` to a suitable location. + +## Using a Container (Docker, Podman, etc.) + +The command line tool `sq` can also be built using an OCI compatible image +builder, eg. podman or docker: + +```shell +$ podman build -f Containerfile -t sq . +$ podman run --rm -i sq --help +``` + +You can then use sq in the container. + +For example searching for a certificate: + +```shell +$ podman run --rm -i sq network search 653909A2F0E37C106F5FAF546C8857E0D8E8F074 +``` + +All sq state is stored under `/sequoia` inside of the container, thus if you +would like to persist the state between container runs you may bind mount the +directory on the host. + +```shell +$ mkdir sq-container # create a directory on the host where you will mount the working dir from the container +$ podman run --rm -i -v $PWD/sq-container:/sequoia sq network search 653909A2F0E37C106F5FAF546C8857E0D8E8F074 +$ podman run --rm -i -v $PWD/sq-container:/sequoia sq inspect --cert 653909A2F0E37C106F5FAF546C8857E0D8E8F074 + +``` + +The container environment has sq manpages and bash completion configured. By +default the container will run sq as its "entrypoint", so if you would like +to be dropped into a shell then override the entrypoint as follows. + +```shell +# Note the "-t"; Necessary for the allocation of a pseudo-TTY. +$ podman run --rm -t -i --entrypoint bash sq +``` + +A current build of the container image is available from the gitlab registry. +Rename it to `sq` locally so that it matches the above commands and for convenience. + +```shell +$ podman pull registry.gitlab.com/sequoia-pgp/sequoia-sq:latest +$ podman tag registry.gitlab.com/sequoia-pgp/sequoia-sq:latest sq +$ podman run --rm -i sq --help +```