Fresh Graylog on Docker local install cannot connect to API

Description of your problem

I’m trying to get a local docker install running of the graylog stack. I’ve followed the instructions (I believe), using the scripts/packages/instructions in the documentation. The Graylog UI comes up at localhost:9000 but I get the message saying it cannot connect to the API. I’m at a loss on what to do next. Would appreciate the help from someone who’s done it.

Description of steps you’ve taken to attempt to solve the issue

I’ve run this script and all containers seem to be fine - no errors that I can see in the logs. Final line shows Graylog started succesfully. Is there any additional configuration I need to do to get the API to connect in Docker? (I xxxx’d out the http as I could only put in two links). Thank you!

docker run --name mongo -d mongo:4.2
docker run --name elasticsearch -e "xxxx.host=0.0.0.0" -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -d docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
docker run --name graylog --link mongo --link elasticsearch  -p 9000:9000 -p 12201:12201 -p 1514:1514 -p 5555:5555  -e GRAYLOG_HTTP_EXTERNAL_URI="xxxx://127.0.0.1:9000/" -d graylog/graylog:4.0

When I go to localhost 9000, the UI is there, but I get the following error still:
We are experiencing problems connecting to the Graylog server running on xxxx://127.0.0.1:9000/api/ . Please verify that the server is healthy and working correctly.

Here’s the tail end of my docker container log for Graylog. I don’t see any errors or anything, and what’s before this seems like it may be irrrelvent - it does show it connects to mongo and elastic serach OK:

11 13:53:28,554 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.collector.periodical.PurgeExpiredCollectorsThread] periodical in [0s], polling every [3600s].

2021-09-11 13:53:46,938 INFO : org.glassfish.grizzly.http.server.NetworkListener - Started listener bound to [0.0.0.0:9000]

2021-09-11 13:53:46,939 INFO : org.glassfish.grizzly.http.server.HttpServer - [HttpServer] Started.

2021-09-11 13:53:46,939 INFO : org.graylog2.shared.initializers.JerseyService - Started REST API at <0.0.0.0:9000>

2021-09-11 13:53:46,939 INFO : org.graylog2.shared.initializers.ServiceManagerListener - Services are healthy

2021-09-11 13:53:46,940 INFO : org.graylog2.shared.initializers.InputSetupService - Triggering launching persisted inputs, node transitioned from Uninitialized [LB:DEAD] to Running [LB:ALIVE]

2021-09-11 13:53:46,940 INFO : org.graylog2.bootstrap.ServerBootstrap - Services started, startup times in ms: {GracefulShutdownService [RUNNING]=0, InputSetupService [RUNNING]=0, BufferSynchronizerService [RUNNING]=0, UrlWhitelistService [RUNNING]=0, JobSchedulerService [RUNNING]=0, OutputSetupService [RUNNING]=0, EtagService [RUNNING]=0, JournalReader [RUNNING]=0, KafkaJournal [RUNNING]=2, UserSessionTerminationService [RUNNING]=4, ConfigurationEtagService [RUNNING]=6, LookupTableService [RUNNING]=6, StreamCacheService [RUNNING]=8, MongoDBProcessingStatusRecorderService [RUNNING]=10, PeriodicalsService [RUNNING]=28, JerseyService [RUNNING]=18413}

2021-09-11 13:53:46,946 INFO : org.graylog2.bootstrap.ServerBootstrap - Graylog server up and running.

Environmental information

Docker 4.0.0 running linux containers

Operating system information

on a Windows 10 machine via Docker Desktop

Package versions

  • Graylog 4.0
  • MongoDB 4.2
  • Elasticsearch 7.10.2
  • Service logs, configuration, and environment variables - Nothing additional set that wasn’t set on docker run script above

Hey there,

So it’s odd that this isn’t working–I’ve not tested this exact scenario, but I have used compose with success on a Windows box. Here’s my default:

version: '3'
services:
  # MongoDB: https://hub.docker.com/_/mongo/
  mongo:
    image: mongo:4
    container_name: mongodb
    networks:
      - graylog
    ports:
      - 27018:27017
    volumes:
      - ./volumes/mongodb:/var/lib/mongodb
  # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
    container_name: elasticsearch
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    deploy:
      resources:
        limits:
          memory: 1g
    ports:
      - 9200:9200
    networks:
      - graylog
    volumes: 
      - ./volumes/elasticsearch:/var/lib/elasticsearch
  # Graylog: https://hub.docker.com/r/graylog/graylog/
  graylog:
    image: graylog/graylog-enterprise:4.1.3
    container_name: graylog
    environment:
      - GRAYLOG_PASSWORD_SECRET=UNOSEEMYPASSWORDS
      - GRAYLOG_ROOT_PASSWORD_SHA2=SUPERSECRETSHAAAAAAA
      - GRAYLOG_HTTP_EXTERNAL_URI=http://127.0.0.1:9000/
      - GRAYLOG_ELASTICSEARCH_VERSION=7
      - GRAYLOG_HTTP_ENABLE_CORS=true
      - GRAYLOG_METRICS_PROMETHEUS_ENABLED=true
    networks:
      - graylog
    depends_on:
      - mongo
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - 9000:9000
      # Syslog TCP
      - 1514:1514
      # Syslog UDP
      - 1514:1514/udp
      # GELF TCP
      - 12201:12201
      # GELF UDP
      - 12201:12201/udp
      # Prometheus Endpoint
      - 9833:9833
    volumes:
      - ./archives:/tmp/graylog-archive
networks:
  graylog:
    driver: bridge

From what I’m seeing, there’s not a whole lot of difference. So I suspect there’s probably something earlier in the log that might shed some light. It might also be worth opening your browser’s dev console to see what errors show up there.

1 Like

Thanks Aaron! Your docker compose worked great for me - Not sure what I was doing wrong, but I’m all set now. I really appreciate the help. Have a great day!

1 Like