admin管理员组文章数量:1277901
I have the following system:
Fedora 41
podman-compose version 1.3.0
podman version 5.3.2
and I followed this tutorial for rootless podman. basically pasta
for rootless networking, and the /etc/subuid
and /etc/subgid
configuration.
Then I tried the following steps:
# creating directories
mkdir -p ~/podman-volumes/mongo/data ~/podman-volumes/mongo/logs
mkdir -p ~/podman-volumes/mongo/config/
# create mongod.conf w/ contents
vim ~/podman-volumes/mongo/config/mongod.conf
storage:
dbPath: /data/db
systemLog:
destination: file
path: /var/log/mongodb/mongo.log
logAppend: true
net:
bindIp: 0.0.0.0
port: 27017
# create directory w/ compose file
mkdir -p ~/mongodb/
vim ~/mongodb/docker-compose.yml
services:
mongodb:
image: mongo:latest
container_name: mongodb
restart: always
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: secret
volumes:
- ~/podman-volumes/mongo/data:/data/db
- ~/podman-volumes/mongo/logs:/var/log/mongodb
- ~/podman-volumes/mongo/config/mongod.conf:/etc/mongod.conf:ro
command: ["--config", "/etc/mongod.conf"]
All directories and files have my current user as owner.
when I first executed podman-compose up
I get the error chown: changing ownership of '/data/db': Permission denied
- I then somewhere found that mongodb is running with user ID 999
inside the container, and I could probably fix it with the following command:
podman unshare chown -R 999:999 ~/podman-volumes/mongo/data
This solved the one mentioned problem, but I still get find: '/data/db': Permission denied
. Somehow this should have been solved by the podman unshare
command, but it didn't.
I tried adding user: "1000:1000"
(which is my current user ID) to the compose file, still no luck.
my question(s):
- what do I need to do to get MongoDB running, with my custom configuration?
- how can I determine which user ID is used in a container ?
Just a note: I'm having the same problems with lots of other images (e.g. Elastic, Logstash) when I provide a custom configuration file and I want the logs to be stored locally, I always get permission denied
本文标签: running MongoDB with rootless podmanStack Overflow
版权声明:本文标题:running MongoDB with rootless podman - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741242808a2364310.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论