# LogDriver.StartLogging: error creating client config: A hosts flag is required

**URL:** https://discuss.elastic.co/t/logdriver-startlogging-error-creating-client-config-a-hosts-flag-is-required/325800
**Category:** Elastic Agent
**Created:** [February 17, 2023, 3:07am UTC](https://discuss.elastic.co/t/logdriver-startlogging-error-creating-client-config-a-hosts-flag-is-required/325800 "2023-02-17T03:07:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cavarzan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cavarzan/32/115817_2.png) [@cavarzan](https://discuss.elastic.co/u/cavarzan)
#### Post date: [February 17, 2023, 3:07am UTC](https://discuss.elastic.co/t/logdriver-startlogging-error-creating-client-config-a-hosts-flag-is-required/325800/1 "2023-02-17T03:07:09Z")

</div>

I'm receiving the following error when I try to start a docker-compose service with elastic-apm.jar configured.

`LogDriver.StartLogging: error creating client config: A hosts flag is required`

I've looked at [this answer](https://discuss.elastic.co/t/elastic-logging-plugin-for-docker-error-creating-client-config-a-hosts-flag-is-required/323202), but how can I fix this using docker-compose?

Why this error happens without any jar update?

elastic apm agent version: tested with 1.35.0 and 1.36.0

docker-compose version 1.24.1, build 4667896b, also tested in 1.25.0  
Client: Docker Engine - Community  
Version: 20.10.22

---

<div class="post-metadata">

### Author: ![kthy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kthy/32/45385_2.png) [@kthy](https://discuss.elastic.co/u/kthy)
#### Post date: [February 19, 2023, 8:54pm UTC](https://discuss.elastic.co/t/logdriver-startlogging-error-creating-client-config-a-hosts-flag-is-required/325800/2 "2023-02-19T20:54:15Z")

</div>

I've done this with success:

```auto
version: "3.4"

services:
  nginx:
    image: nginx:latest
    ports:
      - "8080:80"
    logging:
      driver: "elastic/elastic-logging-plugin:8.6.1"
      options:
        api_key: "${ELASTIC_API_KEY}"
        cloud_id: "${ELASTIC_CLOUD_ID}"
        hosts: ""
        max-size: "8M"
        max-file: "12"

```

Remember to install the plugin on the host first.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 19, 2023, 8:54pm UTC](https://discuss.elastic.co/t/logdriver-startlogging-error-creating-client-config-a-hosts-flag-is-required/325800/3 "2023-03-19T20:54:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
