Running apps in environments


We can run applications with different environment variables that can be used to configure passwords, tokens etc. Our environments are setup in a central place as PKHub Environments and it can be reused during development, across servers and by any other developers we share the Safe with.

The basic command is

pk sh -s <SafeName> -n <Environment> <Command>

For example:

pk sh -s my-group-5 -n myenv 'echo $PASS'
>> dfjaksfjsalfa

Running docker in an environment

pk sh -s my-group-5 -n myenv -i 'docker run -e PORT=$PORT -e PASS=$PASS -it ubuntu bash'

Docker Compose

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

pk sh -s my-group-5 -n myenv 'docker-compose up'