首先确保系统安装了docker和docker-compose
然后新建docker-compose.yaml文件,编辑如下内容
version: '2'
networks:
kong-net:
driver: bridge
services:
kong-database:
image: postgres:9.6
container_name: kong-database
restart: always
networks:
- kong-net
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
POSTGRES_PASSWORD: kong
ports:
- "5432:5432"
#kong数据库的初始化应用,执行一遍即可注释
kong-migration:
container_name: kong-migration
image: kong:latest
command: "kong migrations bootstrap"
networks:
- kong-net
restart: on-failure
environment:
KONG_PG_HOST: kong-database
KONG_DATABASE: postgres
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
KONG_CASSANDRA_CONTACT_POINTS: kong-database
links:
- kong-database
depends_on:
- kong-database
# 启动kong
kong: