Details about how to use Kong in Docker can be found on the DockerHub repository hosting the image: kong. We also have a Docker Compose template with built-in orchestration and scalability.
Install Curl Docker Container Tote
With a Database
Here is a quick example showing how to connect a Kong container to a Cassandra or PostgreSQL container.
Jun 09, 2020 Docker is an application that simplifies the process of managing application processes in containers. In this tutorial, you'll install and use Docker Community Edition (CE) on Ubuntu 20.04. A minimal Docker image based on Alpine Linux has only 5 MB in size, but a lot of tools common for Linux distributions (e.g. Curl) are not installed by default. In this short note i will show how to install curl in Alpine container from the command line. Sep 08, 2020 Now let’s install Docker on Ubuntu 20.04. Run the following command in the terminal window: sudo apt install docker.io. Type y and hit Enter to confirm the installation. Once the install is completed, the output notifies you Docker has been installed.
![Curl Curl](/uploads/1/3/7/3/137300292/114311477.jpg)
- Jan 14, 2018 This page shows how to install, setup and use Docker or Docker CE on RHEL 7 or CentOS 7 server and create your first container. How to install and use Docker on RHEL 7 or CentOS 7 (method 1) The procedure to install Docker is as follows.
- Nov 19, 2019 Docker Compose is a tool used to define and run multi-container Docker applications. Users utilize this software to launch, execute, communicate, and close containers with a single coordinated command. This tutorial will show you how to install Docker Compose on CentOS 7.
- Create a Docker networkYou will need to create a custom network to allow the containers to discover and communicate with each other. In this example
kong-net
is the network name, you can use any name. - Start your databaseIf you wish to use a Cassandra container:If you wish to use a PostgreSQL container:
- Prepare your databaseRun the migrations with an ephemeral Kong container:In the above example, both Cassandra and PostgreSQL are configured, but you should update the
KONG_DATABASE
environment variable with eithercassandra
orpostgres
.Note for Kong < 0.15: with Kong versions below 0.15 (up to 0.14), use theup
sub-command instead ofbootstrap
. Also note that with Kong < 0.15, migrations should never be run concurrently; only one Kong node should be performing migrations at a time. This limitation is lifted for Kong 0.15, 1.0, and above. - Start KongWhen the migrations have run and your database is ready, start a Kong container that will connect to your database container, just like the ephemeral migrations container:
- Use KongKong is running:Quickly learn how to use Kong with the 5-minute Quickstart.
DB-less mode
Install Curl In Docker Container
The steps involved in starting Kong in DB-less mode are the following:
- Create a Docker networkThis is the same as in the Pg/Cassandra guide. We’re also using
kong-net
as the network name and it can also be changed to something else.This step is not strictly needed for running Kong in DB-less mode, but it is a good precaution in case you want to add other things in the future (like a rate-limiting plugin backed up by a Redis cluster). - Create a Docker volumeFor the purposes of this guide, a Docker Volume is a folder inside the host machine which can be mapped into a folder in the container. Volumes have a name. In this case we’re going to name ours
kong-vol
You should be able to inspect the volume now:The result should be similar to this:Notice theMountPoint
entry. We will need that path in the next step. - Prepare your declarative configuration fileThe syntax and properties are described on the Declarative Configuration Format guide.Add whatever core entities (Services, Routes, Plugins, Consumers, etc) you need there.On this guide we’ll assume you named it
kong.yml
.Save it inside theMountPoint
path mentioned in the previous step. In the case of this guide, that would be/var/lib/docker/volumes/kong-vol/_data/kong.yml
- Start Kong in DB-less modeAlthough it’s possible to start the Kong container with just
KONG_DATABASE=off
, it is usuallydesirable to also include the declarative configuration file as a parameter via theKONG_DECLARATIVE_CONFIG
variable name. In order to do this, we need to make the file“visible” from within the container. We achieve this with the-v
flag, which mapsthekong-vol
volume to the/usr/local/kong/declarative
folder in the container. - Use KongKong should be running and it should contain some of the entities added in kong.yml:For example, get a list of services:
Follow Up:
Having Trouble? We're Here to Help!