最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docker compose - starting MongoDB with custom configuration file with Quadlet - Stack Overflow

programmeradmin1浏览0评论

I'm trying to rewrite a docker-compose to quadlet (rootless podman, testing on Fedora41).

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:

  • mongotestwork
[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=mongotestwork
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=mongod --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, and I don't know why. I can't even check if the file is correctly mounted from my local machine into the container.

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

Thanks

Update1 - Logs

these are the latest logs

localhost.localdomain mongodb-q[978440]: 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
发布评论

评论列表(0)

  1. 暂无评论