Some elusive permissions problem running mongodb in docker on AlmaLinux mapping to an external database

33 views Asked by At

I have an AlmaLinux machine on which I installed docker and pulled mongo:6.0 (docker.io/library/mongo:6.0).

When I run: docker run --name mongo -d -p 27017:27017 mongo, it works OK. I can execute commands in it and it looks fine. However, when I try to map /data/db to a local folder (e.g. /data/db), the docker command completes but the docker image is not running (not shown in docker ps but shown in docker ps -a).

The docker log shows these last lines:

Traceback (most recent call last):
  File "/usr/local/bin/docker-entrypoint.py", line 637, in <module>
    subprocess.run(get_final_command_line_args(), check=True)
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['mongod', '--bind_ip_all']' returned non-zero exit status 100.

I know that this error has something to do with permissions (I used to have a CentOS that worked the same and had the same problem). I made sure that the permissions on the /data/db folder are rwxrwxrwx:

ls -ld / /data /data/db
drwxrwxrwx. 22 root root 4096 Nov  6 08:42 /
drwxrwxrwx.  3 root root   16 Nov  6 08:42 /data
drwxrwxrwx.  2 root root    6 Nov  6 08:42 /data/db

I am running as root. I think I am missing something trivial. I have no experience with AlmaLinux and need a direction.

Thank you

0

There are 0 answers