start rootless container with custom configuration and Quadlet

Hello, I’m trying to rewrite a docker-compose file to a quadlet (rootless podman, testing on Fedora 41)

version: "2.2"
services:
  mongodb:
    image: docker.io/mongo:7.0
    container_name: mongodb
    networks:
      my_net:
        aliases:
          - mongodb
    restart: unless-stopped
#    ports:
#      - "27017:27017"
    volumes:
      - ./mongodb/conf/mongod.conf:/etc/mongod.conf:ro
      - ./mongodb/log/:/var/log/mongodb/
      - ./mongodb/data/:/data/mongodb/
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "10"
    command: [ "-f", "/etc/mongod.conf" ]
networks:
  my_net:
    name: my_net
    driver: bridge

and this is what I got with Quadlet:

  • mongotest.network
[Unit]
Description=mongotest network
After=network-online.target

[Network]
NetworkName=mongotest-network

[Install]
WantedBy=default.target
  • mongodb.container
[Unit]
Description=MongoDB service

[Install]
WantedBy=default.target

[Service]
Restart=on-failure


[Container]
Image=docker.io/mongo:7.0
ContainerName=mongodb-q
Network=mongotest.network
PublishPort=27017:27017
Volume=%h/mongotest/conf/mongod.conf:/etc/mongod.conf:ro,Z
Volume=%h/mongotest/data/:/data/db/:Z
Volume=%h/mongotest/log/:/var/log/mongodb/:Z
Exec=--config /etc/mongod.conf # <-- 1

When I leave out the line marked with <-- 1 it works as it’s supposed.

  • it’s up and running, w/o restarting every x seconds
  • the data directory is on my host
  • I can start another container, mongo-express for instance, within the same network, and it’s connecting to MongoDB

but, when I add the line <-- 1 it’s restarting almost every second. The logs tell me the following:

chown: changing ownership of '/proc/1/fd/1': Permission denied
Jan 31 20:12:46 localhost.localdomain mongodb-q[978440]: chown: changing ownership of '/proc/1/fd/2': Permission denied

I just want to pass along the config file MongoDB should use during startup. Any ideas on how to solve this ?

Thanks