Public | Automated Build

Last pushed: 2 years ago
Short Description
Consul server in docker container
Full Description

Consul server in docker container: This Dockerfile will install Consul server in docker container and will monitor all the other containers and services in those containers.

Using the container

1.Use below run command to create the server container:
$ sudo docker run -it -d --name server -h server pujasalampuria/consul:server

  1. To create bootstrapserver container and to link it to server container run:
    $ sudo docker run -it -d --link server:server --name bserver -h bserver pujasalampuria/consul:bootstrapserver

  2. To create webserver container run:
    $ sudo docker run -it -d --name webserver -h webserver -p 8500:8500 pujasalampuria/consul:webserver

  3. Run below command to get the IP address of webserver container:
    $ sudo docker inspect --format '{{.NetworkSettings.IPAddress}}' webserver

5.Run below command to get the IP address of bootstrapserver container:
$ sudo docker inspect --format '{{.NetworkSettings.IPAddress}}' bserver

  1. Execute below command to run Consul agent in Webserver container:
    $ sudo docker exec -it -d webserver consul agent -data-dir /tmp/consul -client $WebServerIP -ui-dir /webconsul -join $BootStrapServerIP

  2. To change the Bootstrap server to simple server run:
    $ sudo docker exec -it -d bserver mv /consul/serverStart.sh /consul/start.sh && sudo docker stop bserver && sudo docker start bserver

Docker Pull Command
Owner
pujasalampuria
Source Repository

Comments (0)