# Problem using SERVER\_PUBLICBASEURL with docker-compose

**URL:** <https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874>\
**Category:** Kibana\
**Tags:** docker\
**Created:** [October 5, 2022, 12:27pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874 "2022-10-05T12:27:19Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 12:27pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/1 "2022-10-05T12:27:19Z")

</div>

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?

```auto
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

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 1:45pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/2 "2022-10-05T13:45:46Z")

</div>

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

looks like you have a space after the `=`

And perhaps you want `SERVERNAME`?

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

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 2:19pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/3 "2022-10-05T14:19:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 2:42pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/4 "2022-10-05T14:42:19Z")

</div>

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

```auto
---
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:

```

```auto
$ hostname
hyperion

```

 ![Screen Shot 2022-10-05 at 7.35.42 AM](https://us1.discourse-cdn.com/elastic/original/3X/3/4/34381e345fb9f042139e430f99f7663081ccfc06.png)

What shows when you run `hostname` on your system?

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

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 2:45pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/5 "2022-10-05T14:45:03Z")

</div>

where did you set hyperion hostname?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 2:46pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/6 "2022-10-05T14:46:24Z")

</div>

> [@mammodde](#):
>
> 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`

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 2:58pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/7 "2022-10-05T14:58:28Z")

</div>

it still says that the page is not accessible

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 3:06pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/8 "2022-10-05T15:06:38Z")

</div>

> [@mammodde](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 3:09pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/9 "2022-10-05T15:09:53Z")

</div>

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

> [@mammodde](#):
>
> the docker-compose is on a separeted server, but on the same network.

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

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 3:17pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/10 "2022-10-05T15:17:01Z")

</div>

Sorry I missed that... Well that is a completely different issue 🙂

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?

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 3:23pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/11 "2022-10-05T15:23:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 5, 2022, 3:29pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/12 "2022-10-05T15:29:24Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![mammodde](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mammodde](https://discuss.elastic.co/u/mammodde)\
**Post date:** [October 5, 2022, 3:38pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/13 "2022-10-05T15:38:32Z")

</div>

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..

---

<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:** [November 2, 2022, 3:38pm UTC](https://discuss.elastic.co/t/problem-using-server-publicbaseurl-with-docker-compose/315874/14 "2022-11-02T15:38:48Z")

</div>

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