# APM Server with docker - Only POST requests are supported

**URL:** <https://discuss.elastic.co/t/apm-server-with-docker-only-post-requests-are-supported/178683>\
**Category:** APM\
**Created:** [April 26, 2019, 3:53pm UTC](https://discuss.elastic.co/t/apm-server-with-docker-only-post-requests-are-supported/178683 "2019-04-26T15:53:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![massilva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/massilva/32/45104_2.png) [@massilva](https://discuss.elastic.co/u/massilva)\
**Post date:** [April 26, 2019, 3:53pm UTC](https://discuss.elastic.co/t/apm-server-with-docker-only-post-requests-are-supported/178683/1 "2019-04-26T15:53:20Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** :  
7.0.0

**Elasticsearch version** :  
7.0.0

**APM Server version** :  
7.0.0

**APM Agent language and version** :  
Python (Django)  
4.2.2

**Browser version** :  
"user-agent": "Mozilla/5.0 (X11; Linux x86\_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36"

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Docker

**Is there anything special in your setup?**  
Using docker-compose, kibana, elasticsearch, apm and django

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

The application (Django) cannot submit data to APM Server.

**Steps to reproduce**

1. Run APM-SERVER with docker-compose

### apm-server.yml

```auto
# https://github.com/elastic/apm-server/blob/master/apm-server.yml
apm-server:
  host: "0.0.0.0:8200"
  secret: "d910fe18cd0fde99ee282685cc7046e14a8491df474b85c8"

setup.kibana:
  host: "kibana:5601"
  username: "elastic"
  password: "changeme"

output.elasticsearch:
  hosts: ["elasticsearch:9200"]
  username: "elastic"
  password: "changeme"
  indices:
    - index: "apm-%{[beat.version]}-sourcemap"
      when.contains:
        processor.event: "sourcemap"

    - index: "apm-%{[beat.version]}-error-%{+yyyy.MM.dd}"
      when.contains:
        processor.event: "error"

    - index: "apm-%{[beat.version]}-transaction-%{+yyyy.MM.dd}"
      when.contains:
        processor.event: "transaction"

    - index: "apm-%{[beat.version]}-span-%{+yyyy.MM.dd}"
      when.contains:
        processor.event: "span"

apm-server.rum.enabled: true
apm-server.rum.event_rate.limit: 300
apm-server.rum.event_rate.lru_size: 1000
apm-server.rum.allow_origins: ['*']
apm-server.rum.library_pattern: "node_modules|bower_components|~"
apm-server.rum.exclude_from_grouping: "^/webpack"
apm-server.rum.source_mapping.cache.expiration: 5m
apm-server.rum.source_mapping.index_pattern: "apm-*-sourcemap*"

```

### kibana.yml

```auto
server:
  name: "kibana"
  host: "0.0.0.0"

elasticsearch:
    #url: "http://elasticsearch:9200"
  hosts: "http://elasticsearch:9200"
  username: "elastic"
  password: "changeme"

```

### Dockerfile

```auto
FROM docker.elastic.co/apm/apm-server:7.0.0
RUN mkdir -p /usr/share/apm-server
COPY ./apm-server.yml /usr/share/apm-server/apm-server.yml
USER root
RUN chown apm-server /usr/share/apm-server/apm-server.yml
USER apm-server

```

### docker-compose.yml

```auto
version: "2.2"
services:
  # https://www.elastic.co/guide/en/apm/server/current/running-on-docker.html
  apm-server:
    #image: docker.elastic.co/apm/apm-server:6.2.3
    build:
        context: .
    container_name: apm-server
    ports:
      - 8200:8200
    networks:
      - apm-net
    volumes:
      - "./apm-server.yml:/usr/share/apm-server/apm-server.yml"
    depends_on:
      elasticsearch:
        condition: service_healthy
    command: --strict.perms=false -e # Avoid the error: "apm-server.yml" can only be writable by the owner.

  # https://www.elastic.co/guide/en/kibana/current/_configuring_kibana_on_docker.html
  kibana:
    image: docker.elastic.co/kibana/kibana:7.0.0
    container_name: apm-kibana
    ports:
      - 5601:5601
    networks:
      - apm-net
    volumes:
      - "./kibana.yml:/usr/share/kibana/config/kibana.yml"
    depends_on:
      elasticsearch:
        condition: service_healthy

  # https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0
    container_name: apm-es
    environment:
      - "ELASTIC_PASSWORD=changeme"
      - "http.host=0.0.0.0"
      - "transport.host=127.0.0.1"
    ports:
      - 9200:9200
    networks:
      - apm-net
    volumes:
      - "esdata:/usr/share/elasticsearch/data"
    healthcheck:
      test: ['CMD', 'curl', '-f', '-u', 'elastic:changeme', 'http://localhost:9200']

volumes:
  esdata:
    driver: local

networks:
  apm-net:

```

### Run

```bash
docker-compose -f docker-compose.yml up -d --build

```

1. Configure the django application using the [APM Python Agent Reference [3.x] - Django Support](https://www.elastic.co/guide/en/apm/agent/python/3.x/django-support.html) documentation.

**Errors in browser console (if relevant)**:

```auto
Failed to submit message: 'Connection to APM Server timed out (url: http://localhost:8200/intake/v2/events, timeout: 5 seconds)'

dropping flushed data due to transport failure back-off

```

APM Server log:

```auto
2019-04-26T15:14:00.366Z	INFO	[request]	beater/intake_handler.go:96	error handling request	{"request_id": "666905ba-8058-4cb9-8a27-b1a59a65213d", "method": "GET", "URL": "/intake/v2/events", "content_length": 0, "remote_address": "172.27.0.1", "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36", "error": "only POST requests are supported"}

```

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [April 29, 2019, 1:24am UTC](https://discuss.elastic.co/t/apm-server-with-docker-only-post-requests-are-supported/178683/2 "2019-04-29T01:24:14Z")

</div>

Hi @massilva, welcome to the forum!

The user-agent in the APM Server log record suggests that you visited "[http://localhost:8200/intake/v2/events](http://localhost:8200/intake/v2/events)" in Safari, which will use the GET method and therefore log that message. This is not particularly relevant to the agent's inability to connect, although it does show that it's accepting connections.

Where is your Django application running? Is it inside Docker? Assuming it is, you will need to update your Django settings with the APM Server URL, per [https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#django-configuration](https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#django-configuration). e.g.

```python
ELASTIC_APM = {
    'SERVICE_NAME': 'my-app',
    'SECRET_TOKEN': 'changeme',
    'SERVER_URL': 'http://apm-server:8200',
}

```

P.S. You pasted the APM Server secret in the forum; you may want to regenerate that now.

P.P.S. You linked to the 3.x docs for the Python agent, but say above that you're using version 4.2.2. It looks like version 4.2.2 is correct, since older versions won't use the URL logged.

---

<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:** [May 19, 2019, 9:24pm UTC](https://discuss.elastic.co/t/apm-server-with-docker-only-post-requests-are-supported/178683/3 "2019-05-19T21:24:22Z")

</div>

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