具有身份验证机制 SCRAM-SHA-1 的 Mongodump

Mongodump with authenticationMechanism SCRAM-SHA-1

我关注mongo docker image:

FROM ubuntu
RUN apt-get update
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list
RUN apt-get update
RUN apt-get install -y mongodb-10gen
RUN mkdir -p /data/db
EXPOSE 27017
CMD ["--port 27017", "--smallfiles"]
ENTRYPOINT usr/bin/mongod 

启动容器并使用 bash 附加到它后,我尝试使用以下命令转储远程数据库。

mongodump --host *.*.*.* -port 27017 -u user -p pass --authenticationDatabase admin --authenticationMechanism SCRAM-SHA-1 --out /tmp/backup/mongodump.json

我得到异常:

connected to: *.*.*.*:27017
assertion: 2 SASL authentication support not compiled into client library.

我应该在图像中添加一些库吗?

已更改 Dockerfile 以安装 latest Mongo version,因为 SCRAM-SHA-1 是在 v3.0

中引入的
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install apt-transport-https -y
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list
RUN apt-get update
RUN apt-get install -y mongodb-org=3.6.2 mongodb-org-server=3.6.2 mongodb-org-shell=3.6.2 mongodb-org-mongos=3.6.2 mongodb-org-tools=3.6.2
RUN mkdir -p /data/db
EXPOSE 27017
CMD ["--port 27017", "--smallfiles"]
ENTRYPOINT usr/bin/mongod