Failing to setup community docker container

Hi,

I’m having issues setting up the community version of mongodb as a docker container on ubuntu22.04.4 desktop VM
I’m using the official documentation: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-community-with-docker/
I can pull the image without issue, but when i perform the second step to run the actual image i get the following warning:

Warning: File MONGO_INITDB_ROOT_USERNAME_FILE is deprecated. Use MONGODB_INITDB_ROOT_USERNAME_FILE instead.
Warning: File MONGO_INITDB_ROOT_PASSWORD_FILE is deprecated. Use MONGODB_INITDB_ROOT_PASSWORD_FILE instead.
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.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['mongod', '--bind_ip_all']' died with <Signals.SIGILL: 4>.

I already tried setting the ip using ‘–bind_ip’ to localhost, ip of the VM, 127.0.0.1 but the container doesn’t want to start.
I think it is a networking issue but i don’t really understand it. Could someone explain it to me?
Regards!

Hi Nicolas.

Can you please provide the full command you are using to spin-up your container? Also, are you launching this container directly through the docker command or using a Dockerfile or a compose yaml?

Looks like the container is dying because of the --bind_ip_all option which is mutually exclusive with the --bind_ip option but, we’ll need the rest of the command/dockerfile/compose to try to help here.

Thank you for helping.
The commands i’m using are from the documentation on the mongodb website as mentioned.
So first i run the following:

docker pull mongodb/mongodb-community-server:latest

to pull in the container.
Then i run the container with:

docker run --name mongodb -p 27017:27017 -d mongodb/mongodb-community-server:latest

When i run docker container ls i don’t see it running. So to determine what the issue was i ran the container in interactive mode:

 docker run --name mongodb -p 27017:27017 -it mongodb/mongodb-community-server:latest

I then the the following message:

Warning: File MONGO_INITDB_ROOT_USERNAME_FILE is deprecated. Use MONGODB_INITDB_ROOT_USERNAME_FILE instead.
Warning: File MONGO_INITDB_ROOT_PASSWORD_FILE is deprecated. Use MONGODB_INITDB_ROOT_PASSWORD_FILE instead.
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.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['mongod', '--bind_ip_all']' died with <Signals.SIGILL: 4>.

Sup Nicolas.

Well, I’ve tried to reproduce here with no luck. Docker image started like a charm as it is supposed to start. Host here is Ubuntu 24.04

nwildner@host:~$ docker run --name mongodb -p 27017:27017 -d mongodb/mongodb-community-server:latest

nwildner@host:~$ docker container ls
CONTAINER ID   IMAGE                                     COMMAND                  CREATED          STATUS          PORTS                                           NAMES
e37ebe545e99   mongodb/mongodb-community-server:latest   "python3 /usr/local/…"   17 seconds ago   Up 16 seconds   0.0.0.0:27017->27017/tcp, :::27017->27017/tcp   mongodb

Running with interactive mode I was also able to start it and check out all the MongoDB initialization logs and stuff:

nwildner@host:~$  docker run --name mongodb-interactive -p 27017:27017 -it mongodb/mongodb-community-server:latest

Warning: File MONGO_INITDB_ROOT_USERNAME_FILE is deprecated. Use MONGODB_INITDB_ROOT_USERNAME_FILE instead.
Warning: File MONGO_INITDB_ROOT_PASSWORD_FILE is deprecated. Use MONGODB_INITDB_ROOT_PASSWORD_FILE instead.
{"t":{"$date":"2024-07-12T15:37:34.953+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2024-07-12T15:37:34.955+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":21},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":21},"outgoing":{"minWireVersion":6,"maxWireVersion":21},"isInternalClient":true}}}
---- CUT ----

One important detail here: Starting with MongoDB 5.0, the AVX processor instruction became mandatory. Further reading:

Based on that, be sure that you are running this container on a physical host that is newer than the processor families documented on the Notes linked above.

You should also look at your virtualization platform specifics on how to pass that instruction to the VM. There is a thread related to this subject at the Proxmox forums where the scenario is similar and the VM needs to have that instruction for MongoDB to work properly.

Cheers. Have a nice weekend.

Hi Nicolas :slight_smile: ,

Thank you for looking into my issue. Th AVX processor instruction was indeed the thing is was missing. I’m using Proxmox to host my VM. When i set the CPU to host instead of a virtual one i was able to start the container!

Thank you for the help! Have a nice day!
Regards

Sup Nicolas. Cool. Really glad that it helped.

If possible, please flag my last comment as an Accepted Answer so it can be highlighted for the next ones who could find this forum thread and are facing the same issue.

Have a nice week ahead.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.