服务端
#https://hub.docker.com/_/mongo
docker pull mongo:7.0.4-jammy
docker run --name mongo --hostname mymongo -d -e MONGO_INITDB_ROOT_USERNAME=gaojinbo \
-e MONGO_INITDB_ROOT_PASSWORD=gaojinbo.com -p 27017:27017 \
-v /data/mongodb/data:/data/db \
mongo:7.0.4-jammy
客户端
docker run -it --rm mongo:7.0.4-jammy \
mongosh --host 192.168.2.27 \
-u gaojinbo \
-p gaojinbo.com \
--authenticationDatabase admin \
local
db.getName();
show databases;