elkninja / elastic-stack-docker-part-one

Getting up and running with Elastic Stack on Docker-Compose
Apache License 2.0
188 stars 119 forks source link

Exiting: error loading config file #4

Closed lukebayesian closed 9 months ago

lukebayesian commented 1 year ago

Hello.

Most of all, thank you for your post https://www.elastic.co/kr/blog/getting-started-with-the-elastic-stack-and-docker-compose It was very helpful. However, I've got error as bellow.

  1. filebeat elastic-stack-docker-part-one-filebeat01-1 | Exiting: error loading config file: config file ("filebeat.yml") can only be writable by the owner but the permissions are "-rwxrwxrwx" (to fix the permissions use: 'chmod go-w /usr/share/filebeat/filebeat.yml') elastic-stack-docker-part-one-filebeat01-1 exited with code 1

  2. metricbeat 2023-06-23 14:26:48 Exiting: error loading config file: config file ("metricbeat.yml") can only be writable by the owner but the permissions are "-rwxrwxrwx" (to fix the permissions use: 'chmod go-w /usr/share/metricbeat/metricbeat.yml')

It gave me suffer because i'm not pro user for docker. Anyway, I figured out to solve it with giving command like bellow.

  1. filebeat

    filebeat01: depends_on: es01: condition: service_healthy image: docker.elastic.co/beats/filebeat:${STACK_VERSION} user: root volumes:

    • certs:/usr/share/filebeat/certs
    • filebeatdata01:/usr/share/filebeat/data
    • "./filebeat_ingest_data/:/usr/share/filebeat/ingest_data/"
    • "./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro"
    • "/var/lib/docker/containers:/var/lib/docker/containers:ro"
    • "/var/run/docker.sock:/var/run/docker.sock:ro" environment:
    • ELASTIC_USER=elastic
    • ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
    • ELASTIC_HOSTS=https://es01:9200
    • KIBANA_HOSTS=http://kibana:5601
    • LOGSTASH_HOSTS=http://logstash01:9600 command: -strict.perms=false
  2. metricbeat

    metricbeat01: depends_on: es01: condition: service_healthy kibana: condition: service_healthy image: docker.elastic.co/beats/metricbeat:${STACK_VERSION} user: root volumes:

    • certs:/usr/share/metricbeat/certs
    • metricbeatdata01:/usr/share/metricbeat/data
    • "./metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro"
    • "/var/run/docker.sock:/var/run/docker.sock:ro"
    • "/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro"
    • "/proc:/hostfs/proc:ro"
    • "/:/hostfs:ro" environment:
    • ELASTIC_USER=elastic
    • ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
    • ELASTIC_HOSTS=https://es01:9200
    • KIBANA_HOSTS=http://kibana:5601
    • LOGSTASH_HOSTS=http://logstash01:9600 command: -strict.perms=false

I am issueing for anybody who suffers like me :)

bashizip commented 1 year ago

Restart and Run everthing as the root user.

SuperElectron commented 1 year ago

I cloned the repo and have tried both these commands with the same error:

docker compose up

sudo docker compose up

Is this supposed to just work?

elkninja commented 1 year ago

This should just work - however, the permissions can be a pain depending on the configuration. I'll commit the changes based on the above command for strict-perms and see if that is helpful.

elkninja commented 9 months ago

strict-perms appears to fix this.