5
votes

I want to run keycloak container with below docker compose file.

version: '2.1'

services:
  # keycloak
  keycloak:
    container_name: keycloak
    image: jboss/keycloak:latest
    restart: always
    ports:
      - 8080:8080
    volumes:
      - C:\logs\keycloak:/usr/app/logs
      - C:\settings:/etc/settings
    environment:
      - KEYCLOAK_USER=admin
      - KEYCLOAK_PASSWORD=admin
      - KEYCLOAK_IMPORT=/etc/settings/realm.json

Everything except realm import works fine in this case. This is shortcut of the error thrown during container run:

Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher) Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /etc/settings/realm.json (Is a directory) Caused by: java.io.FileNotFoundException: /etc/settings/realm.json (Is a directory)"}`

I am sure the file exists in this location. I have checked several different configurations for import e.g. specyfing imported file: C:\settings\realm.json:/etc/settings/realm.json but the result is the same. Have you got any ideas how the proper configuration should look like?

2
What is your environment? Are you trying to run Linux container on Windows host?Moisei

2 Answers

1
votes

I had the same issue. It was caused by the fact that I was attempting to mount a volume using a relative path. I resolved it by replacing all relative paths with absolute paths.

0
votes

SOLVED It appears that the error may be described as follows. error: File is mounted as a directory or mounted directories are empty. reason: Password change to OS. explanation: Docker cannot access files on the system that it works on, as it is after all a virtual machine, due to system’s password change. It does not inform about fail in accessing the file system either, just displays mounted directories in an invalid manner.

UPDATE So the problem in my case was that a system password - Windows, was changed and credentials in docker were not updated. Since it was some time ago I no longer remember how to change the saved credentials in docker, I recall it was easy in the UI, but I know that was the solution - update of the system credentials stored by docker.