Using Mongo through Docker on Apple Silicon

Has anyone successfully run Mongo using Docker on Apple Silicon? I'm getting some weird behavior when launching a container. When I run a basic Mongo container it starts up fine, but then my prisma db push fails with the following error:
Error: MongoDB error
SCRAM failure: Authentication failed.
0: migration_core::state::SchemaPush
at migration-engine/core/src/state.rs:349
Error: MongoDB error
SCRAM failure: Authentication failed.
0: migration_core::state::SchemaPush
at migration-engine/core/src/state.rs:349
I read this is cause prisma needs a replication set, but when i add that to my compose file, the container doesn't want to initialize, and I get this in a continous loop:
{"t":{"$date":"2022-10-06T20:40:25.595+00:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":13000}}
{"t":{"$date":"2022-10-06T20:40:25.595+00:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":13000}}
This is the compose setup:
mongo:
container_name: my-db
image: mongo
env_file:
- .env.development
volumes:
- mongo_db:/data/db
command: --replSet rs0 # this line here seems to be bad
ports:
- 27017:27017
environment:
MONGO_INITDB_DATABASE: ${DATABASE_NAME}
mongo:
container_name: my-db
image: mongo
env_file:
- .env.development
volumes:
- mongo_db:/data/db
command: --replSet rs0 # this line here seems to be bad
ports:
- 27017:27017
environment:
MONGO_INITDB_DATABASE: ${DATABASE_NAME}
Any ideas? Anyone got prisma+mongo+docker to play nice? PS: Not my choice to use Mongo
18 Replies
needmorewood
needmorewood3y ago
What mongo version
julius
juliusOP3y ago
tried a few, latest, 4, 5
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
julius
juliusOP3y ago
i've been trying out different versions of this but everything fails with authentication errors. so frustrated with this so at this point i'm just looking and testing out different compose files and none are working
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
needmorewood
needmorewood3y ago
Maybe just the creds are wrong then?
robotkutya
robotkutya3y ago
how about a different database? why not? come on, give it a try! SQL is great!
julius
juliusOP3y ago
Oh I know, I use SQL whenever I can, but this isn’t my project
robotkutya
robotkutya3y ago
had to ask, sorry no hard feelings ❤️‍🔥
cje
cje3y ago
i had the same situation a while ago, and gave up / ended up "solving" it by developing on a mongodb atlas instance
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
julius
juliusOP3y ago
yea tried that one too, still not working
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
julius
juliusOP3y ago
julius
juliusOP3y ago
changed mongo to mongosh other than that seem to have worked :0. now just need to put that in a compose file
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
julius
juliusOP3y ago
i'll just create a bash file with the second command for now thanks
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server