How to setup decK in docker?

Hi All

I want to use decK in docker. How can I create a container from the given image of decK? I am using the below link for docker installation but I am not able to make it up.

I am using the below command but it is not coming up.

docker run -d --network kong-net kong/deck

Below are the docker logs.

PS C:\Kong> docker logs 3b9fe262ceb9
The deck tool helps you manage Kong clusters with a declarative
configuration file.

It can be used to export, import, or sync entities to Kong.

Usage:
deck [command]

Available Commands:
completion Generate completion script
convert Convert files from one format into another format
diff Diff the current entities in Kong with the one on disks
dump Export Kong configuration to a file
help Help about any command
konnect Configuration tool for Konnect (in alpha)
ping Verify connectivity with Kong
reset Reset deletes all entities in Kong
sync Sync performs operations to get Kong’s configuration to match the state file
validate Validate the state file
version Print the decK version

Flags:
–analytics Share anonymized data to help improve decK. (default true)
–ca-cert string Custom CA certificate to use to verify Kong’s Admin TLS certificate.
This value can also be set using DECK_CA_CERT environment variable.
–config string Config file (default is $HOME/.deck.yaml).
–headers strings HTTP headers (key:value) to inject in all requests to Kong’s Admin API.
This flag can be specified multiple times to inject multiple headers.
-h, --help help for deck
–kong-addr string HTTP address of Kong’s Admin API.
This value can also be set using the environment variable DECK_KONG_ADDR
environment variable. (default “http://localhost:8001”)
–konnect-addr string Address of the Konnect endpoint. (default “https://konnect.konghq.com”)
–konnect-email string Email address associated with your Konnect account.
–konnect-password string Password associated with your Konnect account, this takes precedence over --konnect-password-file flag.
–konnect-password-file string File containing the password to your Konnect account.
–no-color Disable colorized output
–skip-workspace-crud Skip API calls related to Workspaces (Kong Enterprise only).
–timeout int Set a request timeout for the client to connect with Kong (in seconds). (default 10)
–tls-server-name string Name to use to verify the hostname in Kong’s Admin TLS certificate.
This value can also be set using DECK_TLS_SERVER_NAME environment variable.
–tls-skip-verify Disable verification of Kong’s Admin TLS certificate.
This value can also be set using DECK_TLS_SKIP_VERIFY environment variable.
–verbose int Enable verbose logging levels
Setting this value to 2 outputs all HTTP requests/responses
between decK and Kong.

Use “deck [command] --help” for more information about a command.

You run this like a CLI, just like using curl docker image.

I am not sure what you are trying to do but let’s say if you want to run deck ping, you can use below.

######BELOW COMMAND IS WRONG

docker run -d --network kong-net kong/deck --kong-addr <ADMIN_API>

If you want to sync a file, you need to mount the file and sync.

For example:

docker run -i \
  --network kong-net \
  -v $(pwd):/deck \
  kong/deck \
  --kong-addr <ADMIN_API> \
  -s /deck/kong.yaml sync

If you are using deck on a local machine, IMO it is better to install it.

Hi Fomm

I have Kong running in docker on my windows machine and I want to set up decK on docker itself so that I can run import/export of Kong configuration using deck.

I ran the below command given by you but it didn’t add any container to my docker. Let me know will this command just run deck ping or will add a container to docker using deck image?

Maybe I am missing something or doing something wrong. when I am trying to run these command, containers are not getting added to the docker in up and running state. I checked the docker logs which are below. It will be really helpful if you can give me some link or url of deck usage on Docker so that I can make it up and running.

=========================================================
PS C:\Kong> docker logs 4950bbf20a40
The deck tool helps you manage Kong clusters with a declarative
configuration file.

It can be used to export, import, or sync entities to Kong.

Usage:
deck [command]

Available Commands:
completion Generate completion script
convert Convert files from one format into another format
diff Diff the current entities in Kong with the one on disks
dump Export Kong configuration to a file
help Help about any command
konnect Configuration tool for Konnect (in alpha)
ping Verify connectivity with Kong
reset Reset deletes all entities in Kong
sync Sync performs operations to get Kong’s configuration to match the state file
validate Validate the state file
version Print the decK version

Hi Saurabh,

I am sorry, I made a couple mistakes previously about the ping command.

  1. It should not be run in detach mode
  2. I forgot to add ping at the end

Don’t use localhost:8001 because localhost is referring to deck container, you should connect to Kong container. Use Kong container name or ip address when kong and deck are running inside the same network.

For example, try below

docker run --network kong-net kong/deck --kong-addr http://kong:8001 ping

1 Like