By Marone: June 2020

Install and run Kong
with docker

kong brand logo


Goal

This is a qiuck article about how install and run Kong with docker.

Used technologies

Kong Gateway v2.x
Docker 19.x (Runing on Windows)
Curl 7.65

What is Kong

Kong Gateway is a open source API Gateway. Kong Server is a lua application built on top of NGINX and acts like a API front-end.
The server forwards the traffic between consumers and the API's, the flexible Kong's plugin architecture make easy to add more functionality such as a rate limiting, authentication,request/response transformation, and more.
kong gateway

Kong exposes two endpoints:
Since launching Kong on 2015, Kong needs a database to store configuration such as Services, Routes, ...etc. The datastore could be either Cassandra or Postgres. From version 1.1 it has become possible to run kong without a database, this approach will be highlighted in this article.

Installation

Step1: Create a Docker network


Step2: Start and prepare Postgres DB



Step3: Start kong


List docker containers (snippet)


Now Kong is up and running

Configuring a service

Step1: Add a service

The Request Body contains:
name: The Service name
url: The upstream url

Response:

Step2: Add a route

The url specified the service name as attribute {/my-api}, which we created at step 1. With paths we define a path that match this new route.
Response:

Call the API directly


Call the API behind kong



References