Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB 5.0+ requires a CPU with AVX support. Container failed to start #619

Closed
ManojPandey121 opened this issue Apr 28, 2023 · 5 comments
Closed

Comments

@ManojPandey121
Copy link

Docker container is not starting and It only shows warning on docker logs

Docker version : 23.0.4, build f480fb1
Docker-compose version: v2.17.2

docker-compose.yml

services:  
  mongo-db:
    container_name: mongo-db
    image: mongo:6
    volumes:
      - ../psvolumes/mongo6:/data/db
    environment:
      - COMPOSE_PROJECT_NAME=mongo
      - MONGO_INITDB_ROOT_USERNAME=
      - MONGO_INITDB_ROOT_PASSWORD=
    ports:
      - 27017:27017
    networks:
      - mongo_network
    restart: unless-stopped
networks:
    mongo_network:
        driver: bridge

Output:

[+] Running 2/1
✔ Network ams-api_mongo_network Created 0.1s
✔ Container mongo-db Created 0.0s
Attaching to mongo-db
mongo-db |
mongo-db | WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
mongo-db | see https://jira.mongodb.org/browse/SERVER-54407
mongo-db | see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
mongo-db | see also #485 (comment)
mongo-db |
mongo-db exited with code 0
image

This same code is running well on
docker: 20.10.23, build 7155243
docker-compose: 1.29.2, build 5becea4c

@yosifkit
Copy link
Member

The warning is there to let you know why the container is mysteriously crashing (since there is no output from the crashing MongoDB binaries).

I'm a little confused 😕. Are you saying that on one machine that you upgraded docker from 20.10.23 to 23.0.4 and now the mongo:5 image doesn't run?

If these are separate machines, then it is expected that one might not run it even though it is on a newer version of Docker. The version of Docker is not relevant to this error. The mongo:5 image requires a CPU that is new enough (one with AVX support). The MongoDB 5+ binaries released by MongoDB are compiled with a -march=sandybridge, which roughly means "sandybridge or newer", but there are newer CPUs that don't have the required instructions (https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2).

@ManojPandey121
Copy link
Author

ManojPandey121 commented Apr 29, 2023

I am trying to run on totally new server.

I'm a little confused . Are you saying that on one machine that you upgraded docker from 20.10.23 to 23.0.4 and now the mongo:5 image doesn't run?

Also tried downgrading the docker to the old version i.e. 20.10.23 and got the same issue. So yes it is not a docker version problem. This same code was running well in another server (container with older mongo images were also running here) which has almost a similar configuration to the newer one. While trying to setup in totally fresh new server I am having issues.

Since we are running on the container can we solve this by adding some configuration to it?

@martadinata666
Copy link

If the CPU doesn't have that avx capability, you can pin mongo to an older version like mongo:4.4.18

@yosifkit
Copy link
Member

yosifkit commented May 2, 2023

Since we are running on the container can we solve this by adding some configuration to it?

Nope, the compiled MongoDB binaries (5.0+) require a CPU with specific instruction support. There is nothing we can do from the Docker side.

@yosifkit yosifkit closed this as completed May 2, 2023
@jmhunter
Copy link

FWIW I worked around this by replacing the binaries in the MongoDB docker image with self-compiled versions with a different '-march' flag.

More details and links to a docker image to help with mongodb compilation on the linked issue here: #485 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants