Standalone apm-server with elasticsearch 8 in docker not able to connect

Ok I got mine working...

I think you did not setup / load the APM integration... kibana weird but you still need to do that... you need to do that before you start the APM Server

Then I see the assets

GET _cat/indices/.*?v
GET _cat/templates/tra*

# GET _cat/indices/.*?v 200 OK
health status index                                                         uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .fleet-enrollment-api-keys-7                                  0JXPxyXpRFarcWU-7QBuBw   1   0          1            0      6.1kb          6.1kb
green  open   .apm-agent-configuration                                      Y2n3cINATZyg9xhOVsJmmw   1   0          0            0       225b           225b
green  open   .kibana_security_session_1                                    dFOtc-OnTMqevxUGc9p5tw   1   0          1            0      5.7kb          5.7kb
green  open   .kibana-event-log-8.4.0-000001                                LWUfHiPDShyzT_POBu23SA   1   0          1            0      6.2kb          6.2kb
green  open   .geoip_databases                                              C_e4xhUBSQa5IrvzeBfUJQ   1   0         41            0     39.2mb         39.2mb
green  open   .security-7                                                   SxKjtS3wQy2V4UU-G3q5CA   1   0        111            0      336kb          336kb
green  open   .kibana_task_manager_8.4.0_001                                --xVYRnoSt2H4yKCNPD7vw   1   0         25         1397    238.1kb        238.1kb
green  open   .apm-custom-link                                              3lBvbBxQSgW6bd4PWKfiiQ   1   0          0            0       225b           225b
green  open   .kibana_8.4.0_001                                             jBOCGWxGQT-iTKg5OZ_QOA   1   0       2385         1226      8.9mb          8.9mb
green  open   .security-profile-8                                           NT5vs6sOQfW113PXPh0zvA   1   0          1            0      7.7kb          7.7kb
green  open   .fleet-policies-7                                             Sz0IgOoDSuepT3uvZBzEoQ   1   0          3            0       22kb           22kb
green  open   .ds-.logs-deprecation.elasticsearch-default-2022.11.28-000001 cQDV1sFnSyyrDGAOGImXNg   1   0          1            0     12.3kb         12.3kb
green  open   .ds-ilm-history-5-2022.11.28-000001                           W5owRm08QAmWpKbotz9DrQ   1   0          9            0     35.6kb         35.6kb

# GET _cat/templates/tra* 200 OK
traces-apm         [traces-apm-*]         200  [traces-apm@package, traces-apm@custom, .fleet_globals-1, .fleet_agent_id_verification-1]
traces-apm.sampled [traces-apm.sampled-*] 200  [traces-apm.sampled@package, traces-apm.sampled@custom, .fleet_globals-1, .fleet_agent_id_verification-1]
traces-apm.rum     [traces-apm.rum-*]     200  [traces-apm.rum@package, traces-apm.rum@custom, .fleet_globals-1, .fleet_agent_id_verification-1]

Then my apm-server.docker.yml looks like this

apm-server:
  # Defines the host and port the server is listening on. Use "unix:/path/to.sock" to listen on a unix domain socket.
  host: "0.0.0.0:8200"

#-------------------------- Elasticsearch output --------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  # Scheme and port can be left out and will be set to the default (`http` and `9200`).
  # In case you specify and additional path, the scheme is required: `http://elasticsearch:9200/path`.
  # IPv6 addresses should always be defined as: `https://[2001:db8::1]:9200`.
  hosts: ["https://host.docker.internal:9200"]
  ssl.verification_mode: none
  username: "elastic"
  password: "password"

Then I ran...

docker run -d \
  -p 8200:8200 \
  --name=apm-server \
  --user=apm-server \
  --volume="$(pwd)/apm-server.docker.yml:/usr/share/apm-server/apm-server.yml:ro" \
  docker.elastic.co/apm/apm-server:8.5.2 \
  --strict.perms=false -e

Then I got this