hashicorp / docker-consul

Official Docker images for Consul.
Mozilla Public License 2.0
398 stars 238 forks source link

How to write docker-compose setup? #45

Open askaribragimov opened 8 years ago

askaribragimov commented 8 years ago

It is a slight disappointing that docker-compose setup is completely nonexistent in the current official image.

Could you please provide information about how to specify the following docker-compose image:

ronycohen commented 7 years ago
version: '2'
services:
  c1:
    image: consul:0.7.2
    command: consul agent -dev -ui
    container_name: cs1
    ports:
        - "8500:8500"
  c2:
    image: consul:0.7.2
    command: consul agent -dev -join=cmain
    container_name: cs2
    links:
      - c1:cmain
  c3:
    image: consul:0.7.2
    command: consul agent -dev -join=cmain
    container_name: cs3
    links:
      - c1:cmain
riker09 commented 6 years ago

Tried on Ubuntu 16.04 and Windows 10 (with all updates) with latest version of Docker.

docker logs cs2
==> Starting Consul agent...
==> Joining cluster...
==> 1 error(s) occurred:

* Failed to join 172.20.0.2: dial tcp 172.20.0.2:8301: getsockopt: connection refused

Windows Docker Version

> docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:40:09 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:45:38 2017
 OS/Arch:      linux/amd64
 Experimental: true

Ubuntu Docker Version

$ docker version
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.6.2
 Git commit:   092cba3
 Built:        Thu Nov  2 20:40:23 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.6.2
 Git commit:   092cba3
 Built:        Thu Nov  2 20:40:23 2017
 OS/Arch:      linux/amd64
 Experimental: false
EugenMayer commented 6 years ago

i think thats fairly comprehensive: https://github.com/EugenMayer/consul-docker-stability-tests/tree/master/acls

it covers ACL setup, gossip setup and how to automtically configure clients with the runtime generated secrets

marco-lancini commented 6 years ago

I wasn't aware of the link posted by @EugenMayer (https://github.com/EugenMayer/consul-docker-stability-tests/tree/master/acls), but I faced a similar challenge a while ago and I took notes of my setup. For anyone interested: https://www.marcolancini.it/2018/blog-offensive-infrastructure-consul/