Add the Enkryptify CLI to your Dockerfile

RUN apt-get update && apt-get install -y curl && \
    curl -fsSL https://raw.githubusercontent.com/Enkryptify/cli/refs/heads/main/install.sh | sh

Configure your container

Create a limited scope token for your Docker container and set it in your container.

RUN enkryptify configure --token <your-token> [--environment <environment-id>]

It’s recommended to use a limited scope token for Docker containers. This way you don’t need to specify the environment ID. You cannot use the interactive flow for Docker containers.

Run your container

You can now run your container with the Enkryptify CLI.

CMD ["enkryptify", "run", "--", "your", "command"]

You can also export the secrets during the build process. We do not recommend this approach because the secrets will be written to the container image. But in some cases this might be useful.

RUN enkryptify export --format=file > .env
CMD ["your", "command"]