Docker Compose Commands

CommandDescription

docker

Bring up the services
docker-compose up -dBring up the services in the background
docker-compose logs -fView logs for services
docker-compose stopStop the services


Sample docker-compose


docker-compose.yml
version: "3.3"
services:
  elasticsearch:
    container_name: elasticsearch6
    image: docker.elastic.co/elasticsearch/elasticsearch:6.2.3
    hostname: elasticsearch
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx1024m"
      - ELASTIC_PASSWORD=changeme
      - bootstrap.memory_lock=true
    volumes:
      - ./data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
 
  logstash:
    container_name: logstash6
    image: docker.elastic.co/logstash/logstash:6.2.3
    hostname: logstash
    volumes:
      - ./pipeline/:/usr/share/logstash/pipeline/
    ports:
      - 9600:9600
      - 5400:5400
      - 3000:3000
    depends_on:
      - elasticsearch
 
  kibana:
    container_name: kibana6
    image: docker.elastic.co/kibana/kibana:6.2.3
    hostname: kibana
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
  postgres:
    image: postgres:9.6
        #restart: always
    ports:
      - '5432:5432'
    environment:
      POSTGRES_USER: cloudservice
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: keystone
    healthcheck:
      test: pg_isready -U cloudservice -d keystone
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - db-volume:/var/lib/postgresql/data
    networks:
      - my-net


volumes:
  db-volume:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '$PWD/db_data'

networks:
  my-net:



  • No labels