• This repository has been archived on 15/Feb/2022
  • Stars
    star
    1,419
  • Rank 33,151 (Top 0.7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deploy applications described in Compose onto Kubernetes clusters

โš ๏ธ This project is no longer maintained โš ๏ธ

Compose on Kubernetes

CircleCI

Compose on Kubernetes allows you to deploy Docker Compose files onto a Kubernetes cluster.

Table of contents

More documentation can be found in the docs/ directory. This includes:

Get started

Install Compose on Kubernetes on Docker Desktop

Pre-requisites

On Docker Desktop you will need to activate Kubernetes in the settings to use Compose on Kubernetes.

Create compose namespace

  • Create a compose namespace by running kubectl create namespace compose

Deploy etcd

Compose on Kubernetes requires an etcd instance (in addition to the kube-system etcd instance). Please follow How to deploy etcd.

Deploy Compose on Kubernetes

Run installer-[darwin|linux|windows.exe] -namespace=compose -etcd-servers=http://compose-etcd-client:2379.

Check that Compose on Kubernetes is installed

You can check that Compose on Kubernetes is installed by checking for the availability of the API using the command:

$ kubectl api-versions | grep compose
compose.docker.com/v1beta1
compose.docker.com/v1beta2

Deploy a stack

To deploy a stack, you can use the Docker CLI:

$ cat docker-compose.yml
version: '3.3'

services:

  db:
    build: db
    image: dockersamples/k8s-wordsmith-db

  words:
    build: words
    image: dockersamples/k8s-wordsmith-api
    deploy:
      replicas: 5

  web:
    build: web
    image: dockersamples/k8s-wordsmith-web
    ports:
     - "33000:80"

$ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml hellokube

Remove a stack

$ docker stack rm --orchestrator=kubernetes hellokube

Developing Compose on Kubernetes

See the contributing guides for how to contribute code.

Pre-requisites

  • make
  • Docker Desktop (Mac or Windows) with engine version 18.09 or later
  • Enable Buildkit by setting DOCKER_BUILDKIT=1 in your environment
  • Enable Kubernetes in Docker Desktop settings

For live debugging

  • Debugger capable of remote debugging with Delve API version 2
    • Goland run-configs are pre-configured

Debug quick start

Debug install

To build and install a debug version of Compose on Kubernetes onto Docker Desktop, you can use the following command:

$ make -f debug.Makefile install-debug-images

This command:

  • Builds the images with debug symbols
  • Runs the debug installer:
    • Installs debug versions of API server and Compose controller in the docker namespace
    • Creates two debugging LoadBalancer services (unused in this mode)

You can verify that Compose on Kubernetes is running with kubectl as follows:

$ kubectl get all -n docker
NAME                               READY   STATUS    RESTARTS   AGE
pod/compose-7c4dfcff76-jgwst       1/1     Running   0          59s
pod/compose-api-759f8dbb4b-2z5n2   2/2     Running   0          59s

NAME                                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)           AGE
service/compose-api                       ClusterIP      10.98.42.151     <none>        443/TCP           59s
service/compose-api-server-remote-debug   LoadBalancer   10.101.198.179   localhost     40001:31693/TCP   59s
service/compose-controller-remote-debug   LoadBalancer   10.101.158.160   localhost     40000:31167/TCP   59s

NAME                          DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/compose       1         1         1            1           59s
deployment.apps/compose-api   1         1         1            1           59s

NAME                                     DESIRED   CURRENT   READY   AGE
replicaset.apps/compose-7c4dfcff76       1         1         1       59s
replicaset.apps/compose-api-759f8dbb4b   1         1         1       59s

If you describe one of the deployments, you should see *-debug:latest in the image name.

Live debugging install

To build and install a live debugging version of Compose on Kubernetes onto Docker Desktop, you can use the following command:

$ make -f debug.Makefile install-live-debug-images

This command:

  • Builds the images with debug symbols
  • Sets the image entrypoint to run a Delve server
  • Runs the debug installer
    • Installs debug version of API server and Compose controller in the docker namespace
    • Creates two debugging LoadBalancer services
      • localhost:40000: Compose controller
      • localhost:40001: API server
  • The API server and Compose controller only start once a debugger is attached

To attach a debugger you have multiple options:

  • Use GoLand: configuration can be found in .idea of the repository
    • Select the Debug all config, setup breakpoints and start the debugger
  • Set your Delve compatible debugger to point to use locahost:40000 and localhost:40001
    • Using a terminal: dlv connect localhost:40000 then type continue and hit enter

To verify that the components are installed, you can use the following command:

$ kubectl get all -n docker

To verify that the API server has started, ensure that it has started logging:

$ kubectl logs -f -n docker deployment.apps/compose-api compose
API server listening at: [::]:40000
ERROR: logging before flag.Parse: I1207 15:25:13.760739      11 plugins.go:158] Loaded 2 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,MutatingAdmissionWebhook.
ERROR: logging before flag.Parse: I1207 15:25:13.763211      11 plugins.go:161] Loaded 1 validating admission controller(s) successfully in the following order: ValidatingAdmissionWebhook.
ERROR: logging before flag.Parse: W1207 15:25:13.767429      11 client_config.go:552] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
ERROR: logging before flag.Parse: W1207 15:25:13.851500      11 genericapiserver.go:319] Skipping API compose.docker.com/storage because it has no resources.
ERROR: logging before flag.Parse: I1207 15:25:13.998154      11 serve.go:116] Serving securely on [::]:9443

To verify that the Compose controller has started, ensure that it is logging:

kubectl logs -f -n docker deployment.apps/compose
API server listening at: [::]:40000
Version:    v0.4.16-dirty
Git commit: b2e3a6b-dirty
OS/Arch:    linux/amd64
Built:      Fri Dec  7 15:18:13 2018
time="2018-12-07T15:25:19Z" level=info msg="Controller ready"

Reinstall default

To reinstall the default Compose on Kubernetes on Docker Desktop, simply restart your Kubernetes cluster. You can do this by deactivating and then reactivating Kubernetes or by restarting Docker Desktop. See the contributing and debugging guides.

Deploying Compose on Kubernetes

More Repositories

1

awesome-compose

Awesome Docker Compose samples
HTML
34,762
star
2

compose

Define and run multi-container applications with Docker
Go
33,472
star
3

kitematic

Visual Docker Container Management on Mac & Windows
JavaScript
12,247
star
4

labs

This is a collection of tutorials for learning how to use Docker with various tools. Contributions welcome.
PHP
11,518
star
5

docker-bench-security

The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production.
Shell
9,038
star
6

dockercraft

Docker + Minecraft = Dockercraft
Lua
7,185
star
7

docker-py

A Python library for the Docker Engine API
Python
6,800
star
8

machine

Machine management for a container-centric world
Go
6,628
star
9

cli

The Docker CLI
Go
4,850
star
10

build-push-action

GitHub Action to build and push Docker images with Buildx
TypeScript
4,242
star
11

docs

Source repo for Docker's Documentation
Markdown
4,163
star
12

genai-stack

Langchain + Docker + Neo4j + Ollama
Python
3,907
star
13

buildx

Docker CLI plugin for extended build capabilities with BuildKit
Go
3,513
star
14

getting-started

Getting started with Docker
JavaScript
2,911
star
15

libchan

Like Go channels over the network
Go
2,470
star
16

for-mac

Bug reports for Docker Desktop for Mac
2,426
star
17

docker-install

Docker installation script
Shell
2,281
star
18

for-win

Bug reports for Docker Desktop for Windows
1,849
star
19

roadmap

Welcome to the Public Roadmap for All Things Docker! We welcome your ideas.
1,734
star
20

app

Make your Docker Compose applications reusable, and share them on Docker Hub
Go
1,575
star
21

docker-credential-helpers

Programs to keep Docker login credentials safe by storing in platform keystores
Go
1,060
star
22

login-action

GitHub Action to login against a Docker registry
TypeScript
1,029
star
23

setup-buildx-action

GitHub Action to set up Docker Buildx
TypeScript
933
star
24

metadata-action

GitHub Action to extract metadata (tags, labels) from Git reference and GitHub events for Docker
TypeScript
888
star
25

libkv

Distributed key/value store abstraction library
Go
854
star
26

for-linux

Docker Engine for Linux
751
star
27

libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
Go
585
star
28

setup-qemu-action

GitHub Action to install QEMU static binaries
TypeScript
431
star
29

welcome-to-docker

JavaScript
422
star
30

go-plugins-helpers

Go helper packages to extend the Docker Engine
Go
331
star
31

hub-tool

๐Ÿงช Docker Hub experimental CLI tool
Go
330
star
32

community

326
star
33

scout-cli

Docker Scout CLI
Shell
290
star
34

engine-api

DEPRECATED: Please see https://github.com/docker/docker/tree/master/client
Go
265
star
35

hub-feedback

Feedback and bug reports for the Docker Hub
233
star
36

doodle

A Home for Docker Doodles
Go
221
star
37

go-units

Parse and print size and time units in human-readable format
Go
215
star
38

go-connections

Utility package to work with network connections
Go
212
star
39

compose-switch

Go
199
star
40

go-docker

(Still WIP) Official Go SDK for Docker
Go
189
star
41

scan-cli-plugin

Docker Scan is a Command Line Interface to run vulnerability detection on your Dockerfiles and Docker images
Go
181
star
42

bake-action

GitHub Action to use Docker Buildx Bake as a high-level build command
TypeScript
176
star
43

gordon

Cli application to manage github pull requests
Go
176
star
44

docker-ce-packaging

Packaging scripts for Docker CE
Makefile
174
star
45

github-actions

โš ๏ธ This repository is deprecated and has been replaced by docker/build-push-action@v2
Go
163
star
46

sbom-cli-plugin

Plugin for Docker CLI to support SBOM creation using Syft
Go
153
star
47

extensions-sdk

Desktop Extensions SDK
142
star
48

hacktoberfest-2022

Docker Hacktoberfest 2022
140
star
49

go-events

Composable event distribution for Go
Go
131
star
50

node-sdk

Docker CLI gRPC JavaScript SDK
JavaScript
110
star
51

libtrust

Primitives for identity and authorization
Go
107
star
52

compose-ecs

Deploy compose application on ECS
Go
100
star
53

golang-cross

Dockerfile
97
star
54

getting-started-app

A simple application for the getting started guide in Docker's documentation
JavaScript
93
star
55

multi-container-app

EJS
88
star
56

volumes-backup-extension

Back up, clone, restore, and share Docker volumes effortlessly.
PLpgSQL
87
star
57

go-metrics

Package for metrics collection in Docker projects
Go
87
star
58

scout-action

Docker Scout GitHub Action
JavaScript
78
star
59

desktop-linux

Bug reports for Docker Desktop for Linux
76
star
60

containerd-packaging

Linux distro packaging for containerd
Shell
68
star
61

opensource

Contains documentation and scripts related to the management of Open Source at Docker
Go
63
star
62

dev-environments

63
star
63

actions-toolkit

Toolkit for Docker (GitHub) Actions
TypeScript
58
star
64

extension-ideas

A place to suggest new ideas for Docker Extensions and get new ideas of what to build for the larger Docker community
48
star
65

binfmt

Please use https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt instead of this repo
Go
44
star
66

dev-envs-extension

TypeScript
40
star
67

code-of-conduct

40
star
68

index-cli-plugin

Go
40
star
69

whalesay

A repository in support of the Docker's official whalesay image
Perl
39
star
70

labs-make-runbook

TypeScript
38
star
71

HttpOverStream

.NET library for using HTTP 1.1 over streams, especially Windows Named Pipes
C#
33
star
72

scout-demo-service

Dockerfile
33
star
73

buildkit-syft-scanner

BuildKit Syft scanner
Go
23
star
74

get-involved

Get Involved with Docker
CSS
23
star
75

getting-started-todo-app

Sample application to get started with Docker
JavaScript
23
star
76

babashka-pod-docker

Go
20
star
77

packaging

Docker Packaging (apk, deb, rpm, static)
Dockerfile
20
star
78

buildx-desktop

19
star
79

cli-docs-tool

Utilities to generate (reference) documentation for the docker CLI
Go
19
star
80

docker-nodejs-sample

A simple Node.js application for the guide in Docker's documentation
JavaScript
18
star
81

go

Go packages with small patches autogenerated (used for canonical/json)
Go
18
star
82

base-cli-plugin

Experimental Docker CLI plugin to detect base images
Go
16
star
83

notary-official-images

Shell
16
star
84

python-docker

A simple Python app for the Python Language Guide in Docker's Docs
Python
16
star
85

go-imageinspect

Go
15
star
86

docker-dotnet-sample

A simple .NET web application
HTML
14
star
87

github-actions-runner

Docker's containerized github-actions runner
Shell
13
star
88

labs-ai-tools-for-devs

Project AI For Devs (chat-sdlc) - AI agents running containerized tools
Clojure
13
star
89

dc23-secure-workshop

DockerCon 2023 Secure Development with Docker hands-on exercises code
Dockerfile
11
star
90

extensions-submissions

Submit your Docker Extension here
Shell
11
star
91

docker-php-sample

A simple PHP application
PHP
10
star
92

docker-vscode

The Docker VSCode EAP is an extension for VSCode which provides an early preview into new features by Docker.
10
star
93

python-docker-dev

A simple Python app for the Python Language Guide in Docker's Docs
Python
10
star
94

import-restrictions

Restrict imports in your go project
Go
9
star
95

desktop-action

Docker Desktop action
9
star
96

labs-tape

Tape is for packaging applications
Go
8
star
97

engine-sync

Sync moby/moby with docker/engine
Shell
8
star
98

database-extension

TypeScript
7
star
99

bindmount-apps

EJS
7
star
100

compose-desktop

5
star