Here’s the quickest way to spin up and connect to a MongoDB Docker instance. podman is used as a drop-in replacement for Docker.

Create a MongoDB server

podman run --rm -p 27017:27017 --name mongo -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=secret mongo:5.0.9

Connecting to the server

mongo --username root --password secret