piasek
piasek

Reputation: 155

Setting up multiple services that can interact with one another WITHOUT docker-compose

I'm setting up ElasticsSearch, Kibana and Logstash in single docker container. Every tutorial that I've found used docker-compose to configure services, however due to corporate machine's limitations I can't use docker-compose. How do I configure services (namely ES, kibana and logstash) so that these build properly, can run within single container and talk to one another?

I've tested building ElasticSearch and Kibana within single docker container on my local machine by describing services in docker-compose.yml and that succeeded.

version: "2"

services:

  elasticsearch:
    image: elasticsearch:6.5.4
    ports:
      - "9200:9200"
    volumes:
      - ./esdata/:/usr/share/elasticsearch/data/

  kibana:
    image: kibana:6.5.4
    ports:
      - "5601:5601"
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200

The expected outcome would be to be able to build and run ES, Kibana and Logstash. These would be able to communicate with one another. I currently know how to build these as completely separate containers, but don't know how to configure them to "cooperate" with one another without docker-compose.

Upvotes: 0

Views: 206

Answers (1)

David Maze
David Maze

Reputation: 158908

The only important detail is that the two containers need to be on the same Docker network. Docker Compose automatically creates a network for you, but if you're not using that tool, you'll need to do it manually.

docker network create elk
docker run --net elk --name elasticsearch ...
docker run --net elk --name kibana \
  -e ELASTICSEARCH_URL=http://elasticsearch:9200 ...

Upvotes: 2

Related Questions