'How to add the server license for reavenDB with docker composer

Some how it's not clear how to add the server license for ravenDB in a docker compose file.

Docker compose

version: "3.9"
services:
  raven1:
    container_name: raven1
    image: ravendb/ravendb
    ports:
      - 8091:8080
      - 38888:38888
    environment:
      - RAVEN_Setup_Mode=None
      - RAVEN_License_Eula_Accepted=true
      - RAVEN_Security_UnsecuredAccessAllowed=PrivateNetwork
      - RAVEN_License_Path=/Users/********/projects/RavenDB/license.json
    volumes:
      - /Users/********/projects/RavenDB/Data:/opt/RavenDB/Server/RavenData

license.json

{
    "Id": "da9446f7-ad2e-4267-ae62-47ff2f34bc86",
    "Name": "Swisscom",
    "Keys": [
        ...
    ]
}

The license is not added. What is the correct way to add this server license.

enter image description here



Solution 1:[1]

the variable RAVEN_License_Path shows the license path inside the docker. So it should be

RAVEN_License_Path=/opt/RavenDB/Server/RavenLicense/license.json

and add this volume

- /Users/********/projects/RavenLicense:/opt/RavenDB/Server/RavenLicense

Solution 2:[2]

Your RAVEN_License_Path looks like it is pointing to a path on your host machine, and therefore it can't be found from within the container.

Ie it's just an environment variable containing an arbitrary path and the server running within the container will try to resolve this path. But of course it can't because it's a path from an entirely unrelated file system.

So you have two possibilities

  1. You create a new image based on ravendb/ravendb where you add your licensefile
  2. You put your licensefile into a folder that is mounted into the container (similar to your data volume) IMO this is the preferred solution.

In both cases, you need to change your RAVEN_Licence_Path to be a valid path within the running container.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mojtaba Ahadi
Solution 2