Hello here my docker compose.yml the command will execute but after the container will stop. I am tring to use command and entrypoint but the result is the same.
metricbeat:
build: .
command: metricbeat modules enable docker
image: docker.elastic.co/beats/metricbeat-oss:7.12.1
user: root
environment:
- ELASTICSEARCH_HOSTS=opensearch-node1:9200
- KIBANA_HOST=opensearch-dashboards:5601
- ELASTICSEARCH_USERNAME=admin
- ELASTICSEARCH_PASSWORD=admin
volumes:
- metricbeat-data01:/usr/share/metricbeat/data
- /var/run/docker.sock:/var/run/docker.sock
networks:
- opensearch-net
links:
- opensearch-node1
depends_on:
- opensearch-node1
volumes:
opensearch-data1:
metricbeat-data01:
networks:
opensearch-net:
docker composer up
opensearch-node1| Disabling execution of_configuration.sh for
OpenSearch Security Plugin
opensearch-node1| Disabling OpenSearch Security Plugin
metricbeat_1 | Enabled docker
docker_metricbeat_1 exited with code 0 `
by using docker exec will work, but I will do in composer file:
docker exec -ti <container_name> sh -c "metricbeat modulesenable docker && curl -XPOST -H 'osd-xsrf: true' -H 'Content-Type: application/json' 'http://opensearch-dashboards:5601/api/opensearch-dashboards/dashboards/import?exclude=index-pattern&force=true' -d@/usr/share/metricbeat/kibana/7/dashboard/Metricbeat-docker-overview.json"