Carina CLI Docker Image
The are several ways to pass your Carina credentials to your container:
- You can pass the
CARINA_APIKEYenvironment variables with the
- You can pass
--api-keyafter the image argument
...but, the more secure and convenient way is to attach a
/secrets file into the container.
Create a file in your host filesystem that contains
export VAR=VALUE lines, such as this
in the current directory:
export CARINA_USERNAME=me@there export CARINA_APIKEY=...api key goes here...
Run the CLI container and attach that file to
/secrets in the container:
docker run --rm -v $(pwd)/secrets:/secrets itzg/carina-cli ls
Obtaining Credentials Output
As a convenience, this image exposes a
/carina volume and sets
$CARINA_HOME to that path.
You can either attach that volume to a host directory or use
--volumes-from in a downstream container, such as
docker run --name carina-credentials -v $(pwd)/secrets:/secrets itzg/carina-cli credentials my-cluster docker run --volumes-from carina-credentials ...
Notice that I did not include the
--rm flag on the upstream container, so that the container remains present
for downstream attachment.
From the downstream container, your cluster credentials (the Docker client certificates) are available at the
/carina/clusters/<carina username>/<cluster name>
General Usage of the CLI
For general use of the CLI, please refer to the Carina client documentation
Saving carina-cli output in a host directory
The following technique is more tedious than running the
carina-cli directly, but
does let you run via an image rather than downloading the binary. NOTE: the
example shown here assumes the
CARINA_* environment variables have been previously
docker run -v $HOME/.carina:/carina -u $(id -u) \ -e CARINA_USERNAME -e CARINA_APIKEY \ itzg/carina-cli \ credentials YOUR_CLUSTER