Problem using SERVER_PUBLICBASEURL with docker-compose

Hi,
I am currently trying to set the field SERVER_PUBLICSBASEURL on my docker-compose.yml, but it seems that nothing is changing. I can only access to kibana through the ip but not through the hostname I wrote.
the docker-compose is on a separeted server, but on the same network.
Do you have any idea of how this should work?

kibana:
    depends_on:
      es01:
        condition: service_healthy
      es02:
        condition: service_healthy
      es03:
        condition: service_healthy
    image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
    volumes:
      - certs:/usr/share/kibana/config/certs
      - kibanadata:/usr/share/kibana/data
    ports:
      - ${KIBANA_PORT}:5601
    environment:
      - SERVERNAME=kibana
      - ELASTICSEARCH_HOSTS=https://es01:9200
      - ELASTICSEARCH_USERNAME=kibana_system
      - ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
      - ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crt
      - SERVER_PUBLICBASEURL= http://${HOSTNAME}:5601
    mem_limit: ${MEM_LIMIT}
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
        ]
      interval: 10s
      timeout: 10s
      retries: 120

SERVER_PUBLICBASEURL= http://${HOSTNAME}:5601

looks like you have a space after the =

And perhaps you want SERVERNAME?

SERVER_PUBLICBASEURL=http://${SERVERNAME}:5601

basically what I want is to be able to search for the kibana page from chrome typing http://hostname:5601- Am I doing it right?

I do not have to add anything extra ...

You do not needs base SERVER_PUBLICBASEURL unless you are trying to change the base path you are not.

Here is my ultra simple (yes I am sure you will want more) but it works already

---
version: '3'
services:
  elasticsearch:
    container_name: es01
    image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
    # 8.x
    environment: ['CLI_JAVA_OPTS=-Xms1g -Xmx1g','bootstrap.memory_lock=true','discovery.type=single-node','xpack.security.enabled=false', 'xpack.security.enrollment.enabled=false']
    ports:
      - 9200:9200
    networks:
      - elastic
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536

  kibana:
    image: docker.elastic.co/kibana/kibana:${TAG}
    container_name: kib01
    environment:
      XPACK_APM_SERVICEMAPENABLED: "true"
      XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: d1a66dfd-c4d3-4a0a-8290-2abcb83ab3aa
      LOGGING_ROOT_LEVEL: error


    ports:
      - 5601:5601
    networks:
      - elastic

networks:
  elastic:
$ hostname
hyperion

What shows when you run hostname on your system?

Perhaps try the above and see if it works...

where did you set hyperion hostname?

I did not... that is my point... Try my docker compose real quick see if it works.

TAG=8.4.2 docker-compose -f es-kb-compose.yml

it still says that the page is not accessible

but works with localhost?

when you run hostname what do you get?

When you run what do you get...

$ nslookup hyperion <!-- Your Hostname

I think I found what I missed, I was trying to access from a remote pc, as I said here

the prolem is that I'd like to access to kibana with another name instead of typing the ip:5601 (thing that I have to do if I connect to kibana from another pc).
Is there a way to do that?

btw it works with ip:5601

Sorry I missed that... Well that is a completely different issue :slight_smile:

From the remote pc does the host that the docker is running on resolve to an IP..

This sounds like a DNS issue...

so when you run from your local (where docker is NOT running)

nslookup hostnameofdocker

What happens?

yes it is indeed a dns problem, because it says that it is a non-existant domain

1 Like

You can add the docker host and IP to your /etc/hosts on the local (non docker hosts) as a quick hack while you wait for to get the DNS issue resolved ... of course that won't work for others... unless they do the same... that a bad / but quick workaround :slight_smile:

all right, thank you very much.
I'll try to see what I can do with the DNS, as I didn't do anything for it until right now. My bad..

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