Bind mount the directory containing your
declarative configuration into the container. Setting
the working directory to the mount path lets kongctl resolve relative paths
within that directory.
From a directory containing your kongctl.yaml file, preview the changes:
docker run --rm \
-e KONGCTL_DEFAULT_KONNECT_PAT \
--mount type=bind,src="$(pwd)",dst=/work,readonly \
--workdir /work \
kong/kongctl:latest plan --mode apply -f kongctl.yaml --region us
To apply the configuration, allocate an interactive terminal with -it so you
can answer the confirmation prompt:
docker run --rm -it \
-e KONGCTL_DEFAULT_KONNECT_PAT \
--mount type=bind,src="$(pwd)",dst=/work,readonly \
--workdir /work \
kong/kongctl:latest apply -f kongctl.yaml --region us
For automation, omit -it and add --auto-approve to the apply command only
when you intend to apply changes without confirmation.
The mount is read-only because these commands only need to read your files.
If you use a command that writes files into /work, remove readonly and
ensure the directory is writable by the container’s kongctl user. Host paths
outside the mounted directory are not available inside the container.