Docker

1 min read.

PK CLI Docker image

Using our docker image with the pk cli and kubectl tools installed, you can run the pk cli using:

docker run -it -e PK_KEY_ID=$PK_KEY_ID -e PK_KEY_SECRET=$PK_KEY_SECRET pkhub/pk-cli sh

For an example on how to use it in Kubernetes please check out our Kubernetes Secret Management Example.

Running docker with Environments

Docker does not allow you to directly pass through environment variables, they need to be explicitly defined using the -e argument. You can still run the command in an environment and then pass through the variables like the example below.

pk sh --safe my-group-5 --lbls myenv --it 'docker run -e PORT=$PORT -e PASS=$PASS -it ubuntu bash'
Example how to run docker in a PKHub Environment

Docker Compose

Docker Compose, unlike the standard docker run, can use variables from the current shell environment. This allows you to use full PKHub Environments by just running them as below.

pk sh --safe my-group-5 --lbls myenv 'docker-compose up'