Volume use in two or more containers

Hi everyone,
I have a Docker Compose addon on an OMV server.
My problem is that I can’t manage to link volumes that I need in several containers.

After I had the Docker Compose plugin running, I set up the following containers.
But my problem is that I can’t see the Openhab gogs with the log viewer and in the second step I have to be able to edit the openhab config files with vscode. But I can’t even get the log viewer to work.

I urgently need help here!

----------------------------------------
OpenHab
----------------------------------------
version: '2.2'

services:
  openhab:
    image: "openhab/openhab:4.0.4"
    restart: always
    network_mode: host
    command: "bash -c 'if [ -e /openhab/restore/restore.zip ]; then echo y |/openhab/runtime/bin/restore /openhab/restore/restore.zip ; fi; exec tini -s ./start.sh server'"
    ports:
      - 2001:2001 #Homematic RF components: 2001
      - 2000:2000 #Homematic WIRED components: 2000
      - 2010:2010 #Homematic HMIP components: 2010
      - 8701:8701 #Homematic CUxD: 8701
      - 8181:8181 #Homematic TclRegaScript: 8181
      - 9292:9292 #Homematic Groups: 9292
      - 9125:9125 #Homematic FROM the gateway to the binding:XML-RPC: 9125
      - 9126:9126 #Homematic FROM the gateway to the binding:BIN-RPC: 9126
      - 43439:43439 #Homematic CCU Autodiscovery: UDP 43439
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "openhab_addons:/openhab/addons"
      - "openhab_conf:/openhab/conf"
      - "openhab_userdata:/openhab/userdata"
      - "openhab_restore:/openhab/restore"
      - "openhab_backup:/openhab/backup"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"

volumes:
  openhab_addons:
    driver: local
  openhab_conf:
    driver: local
  openhab_userdata:
    driver: local
  openhab_restore:
    driver: local
  openhab_backup:
    driver: local
----------------------------------------
MQTT
----------------------------------------
version: '3.8'

services:
  mosquitto:
    image: "eclipse-mosquitto:latest"
    restart: always
    ports:
      - 1883:1883
      - 8883:8883
      - 9001:9001 # some images use this port, check and change the host port accordingly
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "mosquitto_config:/mosquitto/config" # you've to create a conf file, see below for sample
      - "mosquitto_data:/mosquitto/data"
      - "mosquitto_log:/mosquitto/log"
    networks:
      - mosquitto
networks:
  mosquitto:
    name: mosquitto
    driver: bridge
  #####
  # Sample mosquitto.conf
  #####
  # persistence true
  # persistence_location /mosquitto/data/
  # log_dest file /mosquitto/log/mosquitto.log
  # allow_anonymous true
  # listener 1883
  ####

volumes:
  mosquitto_config:
    driver: local
  mosquitto_data:
    driver: local
  mosquitto_log:
    driver: local
----------------------------------------
Portainer
----------------------------------------
---
version: "3"
services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "portainer-data:/data"
    ports:
      - 9000:9000
volumes:
  portainer-data:
    driver: local
----------------------------------------
WIKI
----------------------------------------
---
# https://hub.docker.com/r/linuxserver/dokuwiki
version: "2.1"
services:
  dokuwiki:
    image: lscr.io/linuxserver/dokuwiki:latest
    container_name: dokuwiki
    environment:
      - PUID=1005
      - PGID=100
      - TZ=Europe/Berlin
    volumes:
      - "WIKI_config:/config"
    ports:
      - 8081:80
      - 443:443 #optional
    restart: unless-stopped


volumes:
  WIKI_config:
    driver: local
----------------------------------------
LogViewer - here i need only read only acces to the log files
----------------------------------------
version: '2.2'

services:
  frontail:
    image:  "welteki/frontail-openhab:latest"
    restart: unless-stopped
    command: " --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab_AEM.json -t openhab_AEM -l 5000 -n 100 /logs/logs/openhab.log /logs/logs/events.log"
    volumes:
# Here i tried severel variants
#    - "openhab_prod_openhab_userdata/logs:/logs:ro"
#    - "openhab_prod_openhab_userdata:/logs:ro"
#    - "openhab_userdata:/logs:ro"
     - "/var/lib/docker/volumes/openhab_prod_openhab_userdata/_data:/logs:ro"
    ports:
    - "9201:9001"

volumes:
  openhab_prod_openhab_userdata:
    external: true
    name: openhab_prod_openhab_userdata
----------------------------------------
VS Code - here i need read and write acces to the config files of open hab
----------------------------------------
---
version: "2.1"
services:
  code-server:
    image: lscr.io/linuxserver/code-server:latest
    container_name: code-server
    environment:
      - PUID=1005
      - PGID=100
      - TZ=Etc/UTC
#      - PASSWORD=password #optional
#      - HASHED_PASSWORD= #optional
#      - SUDO_PASSWORD=password #optional
#      - SUDO_PASSWORD_HASH= #optional
#      - PROXY_DOMAIN=code-server.my.domain #optional
#      - DEFAULT_WORKSPACE=/config/workspace #optional
    volumes:
      - "VSCode_Config:/config"
# here i have to add zhe open hab config but firsti tried to fix the log viewer
    ports:
      - 8444:8443
    restart: unless-stopped


volumes:
  VSCode_Config:
    driver: local


----------------------------------------
My System:
----------------------------------------
================================================================================
= OS/Debian information
================================================================================
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

================================================================================
= openmediavault information
================================================================================
Release: 6.9.12-2
Codename: Shaitan
Client: Docker Engine - Community
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:08:17 2023
 OS/Arch:           linux/amd64
 Context:           default


Server: Docker Engine - Community
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.27
  GitCommit:        a1496014c916f9e62104b33d1bb5bd03b0858e59
 runc:
  Version:          1.1.11
  GitCommit:        v1.1.11-0-g4bccb38
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

When using compose, the volume names will probably be prefixed with the project name, like networks, run docker volumes ls.

Similar to networks you can probably use name: in the definition at the bottom to use a fixed name.

The Container came up with no error but

The Log of the LogView show me:

2024-02-10T15:07:16.025640040Z node: bad option: --disable-usage-stats
2024-02-10T15:07:16.025710022Z node: bad option: --ui-highlight
2024-02-10T15:07:16.025721203Z node: bad option: --ui-highlight-preset

And the conection is not possible on Port :9201

My Volumes:

DRIVER    VOLUME NAME
local     USB-Stick
local     mqtt_mosquitto_config
local     mqtt_mosquitto_data
local     mqtt_mosquitto_log
local     openhab_prod_openhab_addons
local     openhab_prod_openhab_backup
local     openhab_prod_openhab_conf
local     openhab_prod_openhab_restore
local     openhab_prod_openhab_userdata
local     portainer_portainer-data
local     vscode_VSCode_Config
local     wiki_WIKI_config

Aktuell Config:

version: '2.2'

services:
  frontail:
    image:  "welteki/frontail-openhab:latest"
    restart: unless-stopped
    command: " --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab_AEM.json -t openhab_AEM -l 5000 -n 100 /logs/logs/openhab.log /logs/logs/events.log"
    volumes:
    - "openhab_userdata:/logs:ro"
#     - "/var/lib/docker/volumes/openhab_prod_openhab_userdata/_data:/logs:ro"
    ports:
    - "9201:9001"

volumes:
  openhab_userdata:
    external: true
    name: openhab_prod_openhab_userdata

Have you checked if all containers that need to access the same volume/bind run their main process with the same UID:GID?

You need to make sure the directory/file owner and the processes in all containers that try to access them have the same UID:GID.

For instance your dokuwiki container uses environment variables PUID and PGID to configure this. This is a built-in feature by the maintainer of this image. Some images provide this feature, most don’t. You can set the UID:GID by configuring user: UID:GID as sibling entry to image:. Though, this will not work, if the container requires to be started as root…