1

How can you run Kudu, which requires two containers - one for the master and one for the tserver under docker, when the two containers need to connect to each other by DNS.

Kudu can be run under Docker using the following commands:

docker run --name kudu-master --hostname kudu-master --detach --publish 8051:8051 --publish 7051:7051 kunickiaj/kudu master

and:

docker run --name kudu-tserver --hostname kudu-tserver --detach --publish 8050:8050 --publish 7050:7050 --link kudu-master --env KUDU_MASTER=kudu-master kunickiaj/kudu tserver

However, the above defines a one way link, from kudu-tserver to kudu-master and not vice verse.

For Kudu to function correctly, bother kudu-master and kudu-tserver need to be able to connect to each other.

How can the Docker containers be configured, so that the two way link works?

tk421
  • 5,775
  • 6
  • 23
  • 34
Danny Varod
  • 17,324
  • 5
  • 69
  • 111

1 Answers1

1

The link parameter in docker run is a legacy feature which may be removed (references [1] and [2]).

You can raise multiple Docker containers and connect them to each other using docker-compose.

To get this working, create a folder named kudu and place the following docker-compose.yml file under it:

version: '3'
services:
  kudu-master:
    image: "kunickiaj/kudu"
    hostname: kudu-master
    ports:
      - "8051:8051"
      - "7051:7051"
    command:
      master
    networks:
      kudu_network:
        aliases:
          - kudu-master
  kudu-tserver:
    image: "kunickiaj/kudu"
    hostname: kudu-tserver
    ports:
      - "8050:8050"
      - "7050:7050"
    environment:
      - KUDU_MASTER=kudu-master
    command:
      tserver
    networks:
      kudu_network:
        aliases:
          - kudu-tserver
networks:
  kudu_network:

This file includes 2 services (kudu-master and kudu-tserver) and a network within which both have aliases which are visible to the rest of the network (to each other). [File reference]

Then run docker-compose using the following command line:

docker-compose -f "filePathToYourDockerComposeYmlFile" up -d

or, if you want to recreate the Docker containers:

docker-compose -f "filePathToYourDockerComposeYmlFile" up -d --force-recreate

Other useful commands [reference]:

To stop the containers:

docker-compose -f "filePathToYourDockerComposeYmlFile" stop

To remove the containers:

docker-compose -f "filePathToYourDockerComposeYmlFile" rm -f
Danny Varod
  • 17,324
  • 5
  • 69
  • 111