Search code examples
dockerdocker-composeorientdb

Can't set root password for OrientDB using docker-compose


I'm using the latest orientdb docker image in my docker-compose. I need to set the default root password but it's not working. My docker-compose.yml:

orientdb:
  image: orientdb
  ports:
    - "2434:2434"
    - "2480:2480"
    - "2424:2424"
  volumes:
    - "/mnt/sda1/dockerVolumes/orientdb:/opt/orientdb/databases"
  environment:
    - ORIENTDB_ROOT_PASSWORD

I'm currently running:

$ export ORIENTDB_ROOT_PASSWORD=anypw
$ docker-compose up -d

Solution

  • You need to define password in docker-compose:

    environment:
    - ORIENTDB_ROOT_PASSWORD=anypw
    

    if you want to hide your password from docker-compose you can create docker-compose:

    environment:
    - ORIENTDB_ROOT_PASSWORD=${ORIENTDB_ROOT_PASSWORD}
    

    I have been able to reproduce your solution and it works:

    docker-compose.yml

    version: '2'
    services:
     orientdb:
      image: orientdb
      ports:
        - "2434:2434"
        - "2480:2480"
        - "2424:2424"
      environment:
        - ORIENTDB_ROOT_PASSWORD=test
    

    now:

    $ docker-compose up -d
    Creating network ... with the default driver
    Creating test_orientdb_1
    $ docker ps
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                    NAMES
    d1f0a4a81222        orientdb            "server.sh"         31 seconds ago      Up 22 seconds       0.0.0.0:2424->2424/tcp, 0.0.0.0:2434->2434/tcp, 0.0.0.0:2480->2480/tcp   test_orientdb_1
    

    User: root
    Pass: test

    You probably tried to log in, but you have not created database.
    enter image description here

    Just create one and try to log in.

    enter image description here