专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

bitnami/mongodb Docker 镜像 - 轩辕镜像

mongodb
bitnami/mongodb
自动构建
Bitnami MongoDB安全镜像是一款针对MongoDB数据库精心打造的预配置解决方案,集成全面安全加固措施、性能优化组件及跨平台兼容性,旨在帮助用户快速部署稳定可靠的MongoDB环境,其遵循企业级安全标准,包含自动更新机制、访问控制策略及数据加密功能,有效保障数据完整性与系统安全性,同时简化安装配置流程,支持一键部署至各类云平台或本地服务器,适用于从小型项目到大型企业级应用的多样化场景,为开发者和运维人员提供高效、安全、便捷的数据库运行环境。
266 收藏0 次下载activebitnami镜像
🚀专业版镜像服务,面向生产环境设计
版本下载
🚀专业版镜像服务,面向生产环境设计

MongoDB® packaged by Bitnami

What is MongoDB®?

MongoDB® is a relational open source NoSQL database. Easy to use, it stores data in JSON-like documents. Automated scalability and high-performance. Ideal for developing cloud native applications.

Overview of MongoDB® Disclaimer: The respective trademarks mentioned in the offering are owned by the respective companies. We do not provide a commercial license for any of these products. This listing has an open-source license. MongoDB(R) is run and maintained by MongoDB, which is a completely separate project from Bitnami.

TL;DR

console
docker run --name mongodb bitnami/mongodb:latest

Why use Bitnami Secure Images?

Those are hardened, minimal CVE images built and maintained by Bitnami. Bitnami Secure Images are based on the cloud-optimized, security-hardened enterprise OS Photon Linux. Why choose BSI images?

  • Hardened secure images of popular open source software with Near-Zero Vulnerabilities
  • Vulnerability Triage & Prioritization with VEX Statements, KEV and EPSS Scores
  • Compliance focus with FIPS, STIG, and air-gap options, including secure bill of materials (SBOM)
  • Software supply chain provenance attestation through in-toto
  • First class support for the internet’s favorite Helm charts

Each image comes with valuable security metadata. You can view the metadata in our public catalog here. Note: Some data is only available with commercial subscriptions to BSI.

!Alt text !Alt text

If you are looking for our previous generation of images based on Debian Linux, please see the Bitnami Legacy registry.

How to deploy MongoDB® in Kubernetes?

Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the Bitnami MongoDB® Chart GitHub repository.

Why use a non-root container?

Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.

Supported tags and respective Dockerfile links

Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.

You can see the equivalence between the different tags by taking a look at the tags-info.yaml file present in the branch folder, i.e bitnami/ASSET/BRANCH/DISTRO/tags-info.yaml.

Subscribe to project updates by watching the bitnami/containers GitHub repo.

Get this image

The recommended way to get the Bitnami MongoDB® Docker Image is to pull the prebuilt image from the Docker Hub Registry.

console
docker pull bitnami/mongodb:latest

To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.

console
docker pull bitnami/mongodb:[TAG]

If you wish, you can also build the image yourself by cloning the repository, changing to the directory containing the Dockerfile and executing the docker build command. Remember to replace the APP, VERSION and OPERATING-SYSTEM path placeholders in the example command below with the correct values.

console
git clone [***]
cd bitnami/APP/VERSION/OPERATING-SYSTEM
docker build -t bitnami/APP:latest .

Persisting your database

If you remove the container all your data will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.

For persistence you should mount a directory at the /bitnami/mongodb path. If the mounted directory is empty, it will be initialized on the first run.

console
docker run \
    -v /path/to/mongodb-persistence:/bitnami/mongodb \
    bitnami/mongodb:latest

or by modifying the docker-compose.yml file present in this repository:

diff
 ...
 services:
   mongodb:
     ...
     volumes:
-      - mongodb_data:/bitnami/mongodb
+      - /path/to/mongodb-persistence:/bitnami/mongodb
   ...

NOTE: As this is a non-root container, the mounted files and directories must have the proper permissions for the UID 1001.

Connecting to other containers

Using Docker container networking, a MongoDB® server running inside a container can easily be accessed by your application containers.

Containers attached to the same network can communicate with each other using the container name as the hostname.

Using the Command Line

In this example, we will create a MongoDB® client instance that will connect to the server instance that is running on the same docker network as the client.

Step 1: Create a network
console
docker network create app-tier --driver bridge
Step 2: Launch the MongoDB® server instance

Use the --network app-tier argument to the docker run command to attach the MongoDB® container to the app-tier network.

console
docker run -d --name mongodb-server \
    --network app-tier \
    bitnami/mongodb:latest
Step 3: Launch your MongoDB® client instance

Finally we create a new container instance to launch the MongoDB® client and connect to the server created in the previous step:

console
docker run -it --rm \
    --network app-tier \
    bitnami/mongodb:latest mongo --host mongodb-server
Using a Docker Compose file

When not specified, Docker Compose automatically sets up a new network and attaches all deployed services to that network. However, we will explicitly define a new bridge network named app-tier. In this example we assume that you want to connect to the MongoDB® server from your own custom application image which is identified in the following snippet by the service name myapp.

yaml
version: '2'

networks:
  app-tier:
    driver: bridge

services:
  mongodb:
    image: bitnami/mongodb:latest
    networks:
      - app-tier
  myapp:
    image: YOUR_APPLICATION_IMAGE
    networks:
      - app-tier

IMPORTANT:

  1. Please update the YOUR_APPLICATION_IMAGE_ placeholder in the above snippet with your application image
  2. In your application container, use the hostname mongodb to connect to the MongoDB® server

Launch the containers using:

console
docker-compose up -d

Configuration

Environment variables
Customizable environment variables
NameDescriptionDefault Value
MONGODB_MOUNTED_CONF_DIRDirectory for including custom configuration files (that override the default generated ones)${MONGODB_VOLUME_DIR}/conf
MONGODB_INIT_RETRY_ATTEMPTSMaximum retries for checking the service initialization status7
MONGODB_INIT_RETRY_DELAYTime (in seconds) to wait between retries for checking the service initialization status5
MONGODB_PORT_NUMBERMongoDB port$MONGODB_DEFAULT_PORT_NUMBER
MONGODB_EXTRA_FLAGSExtra flags for MongoDB initializationnil
MONGODB_ENABLE_NUMACTLExecute commands using numactlfalse
MONGODB_SHELL_EXTRA_FLAGSExtra flags when using the mongodb client during initialization (useful when mounting init scripts)nil
MONGODB_ADVERTISED_HOSTNAMEHostname to use for advertising the MongoDB servicenil
MONGODB_ADVERTISE_IPWhether advertised hostname is set to container ipfalse
MONGODB_ADVERTISED_PORT_NUMBERMongoDB advertised port number. It is recommended to pass this environment variable if you have a proxy port forwarding requests to container.nil
MONGODB_DISABLE_JAVASCRIPTDisable MongoDB server-side javascript executionno
MONGODB_ENABLE_JOURNALEnable MongoDB journalnil
MONGODB_DISABLE_SYSTEM_LOGDisable MongoDB daemon system lognil
MONGODB_ENABLE_DIRECTORY_PER_DBUse a separate folder for storing each database datanil
MONGODB_ENABLE_IPV6Use IPv6 for database connectionsnil
MONGODB_SYSTEM_LOG_VERBOSITYMongoDB daemon log levelnil
MONGODB_ROOT_USERUser name for the MongoDB root userroot
MONGODB_ROOT_PASSWORDPassword for the MongoDB root usernil
MONGODB_USERNAMEUser to generate at initialization timenil
MONGODB_PASSWORDPassword for the non-root user specified in MONGODB_USERNAMEnil
MONGODB_DATABASEName of the database to create at initialization timenil
MONGODB_METRICS_USERNAMEUser used for metrics collection, for example with mongodb_exporternil
MONGODB_METRICS_PASSWORDPassword for the non-root user specified in MONGODB_METRICS_USERNAMEnil
MONGODB_EXTRA_USERNAMESComma or semicolon separated list of extra users to be created.nil
MONGODB_EXTRA_PASSWORDSComma or semicolon separated list of passwords for the users specified in MONGODB_EXTRA_USERNAMES.nil
MONGODB_EXTRA_DATABASESComma or semicolon separated list of databases to create at initialization time for the users specified in MONGODB_EXTRA_USERNAMES.nil
ALLOW_EMPTY_PASSWORDPermit accessing MongoDB without setting any passwordno
MONGODB_REPLICA_SET_MODEMongoDB replica set mode. Can be one of primary, secondary or arbiternil
MONGODB_REPLICA_SET_NAMEName of the MongoDB replica set$MONGODB_DEFAULT_REPLICA_SET_NAME
MONGODB_REPLICA_SET_KEYMongoDB replica set keynil
MONGODB_INITIAL_PRIMARY_HOSTHostname of the replica set primary node (necessary for arbiter and secondary nodes)nil
MONGODB_INITIAL_PRIMARY_PORT_NUMBERPort of the replica set primary node (necessary for arbiter and secondary nodes)27017
MONGODB_INITIAL_PRIMARY_ROOT_PASSWORDPrimary node root user password (necessary for arbiter and secondary nodes)nil
MONGODB_INITIAL_PRIMARY_ROOT_USERPrimary node root username (necessary for arbiter and secondary nodes)root
MONGODB_SET_SECONDARY_OKMark node as readable. Necessary for cases where the PVC is lostno
MONGODB_DISABLE_ENFORCE_AUTHBy default, MongoDB authentication will be enforced. If set to true, MongoDB will not enforce authenticationfalse
Read-only environment variables
NameDescriptionValue
MONGODB_VOLUME_DIRPersistence base directory$BITNAMI_VOLUME_DIR/mongodb
MONGODB_BASE_DIRMongoDB installation directory$BITNAMI_ROOT_DIR/mongodb
MONGODB_CONF_DIRMongoDB configuration directory$MONGODB_BASE_DIR/conf
MONGODB_DEFAULT_CONF_DIRMongoDB default configuration directory$MONGODB_BASE_DIR/conf.default
MONGODB_LOG_DIRMongoDB logs directory$MONGODB_BASE_DIR/logs
MONGODB_DATA_DIRMongoDB data directory${MONGODB_VOLUME_DIR}/data
MONGODB_TMP_DIRMongoDB temporary directory$MONGODB_BASE_DIR/tmp
MONGODB_BIN_DIRMongoDB executables directory$MONGODB_BASE_DIR/bin
MONGODB_TEMPLATES_DIRDirectory where the mongodb.conf template file is stored$MONGODB_BASE_DIR/templates
MONGODB_MONGOD_TEMPLATES_FILEPath to the mongodb.conf template file$MONGODB_TEMPLATES_DIR/mongodb.conf.tpl
MONGODB_CONF_FILEPath to MongoDB configuration file$MONGODB_CONF_DIR/mongodb.conf
MONGODB_KEY_FILEPath to the MongoDB replica set keyfile$MONGODB_CONF_DIR/keyfile
MONGODB_DB_SHELL_FILEPath to MongoDB dbshell file/.dbshell
MONGODB_RC_FILEPath to MongoDB rc file/.mongorc.js
MONGOSH_DIRPath to mongosh directory/.mongodb
MONGOSH_RC_FILEPath to mongosh rc file/.mongoshrc.js
MONGODB_PID_FILEPath to the MongoDB PID file$MONGODB_TMP_DIR/mongodb.pid
MONGODB_LOG_FILEPath to the MongoDB log file$MONGODB_LOG_DIR/mongodb.log
MONGODB_INITSCRIPTS_DIRPath to the MongoDB container init scripts directory/docker-entrypoint-initdb.d
MONGODB_DAEMON_USERMongoDB system usermongo
MONGODB_DAEMON_GROUPMongoDB system groupmongo
MONGODB_DEFAULT_PORT_NUMBERMongoDB port set at build time27017
MONGODB_DEFAULT_ENABLE_JOURNALEnable MongoDB journal at build timetrue
MONGODB_DEFAULT_DISABLE_SYSTEM_LOGDisable MongoDB daemon system log set at build timefalse
MONGODB_DEFAULT_ENABLE_DIRECTORY_PER_DBUse a separate folder for storing each database data set at build timefalse
MONGODB_DEFAULT_ENABLE_IPV6Use IPv6 for database connections set at build timefalse
MONGODB_DEFAULT_SYSTEM_LOG_VERBOSITYMongoDB daemon log level set at build time0
MONGODB_DEFAULT_REPLICA_SET_NAMEName of the MongoDB replica set at build timereplicaset
Initializing a new instance

When the container is executed for the first time, it will execute the files with extensions .sh, and .js located at /docker-entrypoint-initdb.d.

In order to have your custom files inside the docker image you can mount them as a volume.

Passing extra command-line flags to mongod startup

Passing extra command-line flags to the mongod service command is possible through the following env var:

  • MONGODB_EXTRA_FLAGS: Flags to be appended to the mongod startup command. No defaults
  • MONGODB_CLIENT_EXTRA_FLAGS: Flags to be appended to the mongo command which is used to connect to the (local or remote) mongod daemon. No defaults
console
docker run --name mongodb -e ALLOW_EMPTY_PASSWORD=yes -e MONGODB_EXTRA_FLAGS='--wiredTigerCacheSizeGB=2' bitnami/mongodb:latest

or by modifying the docker-compose.yml file present in this repository:

yaml
services:
  mongodb:
  ...
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MONGODB_EXTRA_FLAGS=--wiredTigerCacheSizeGB=2
  ...
Configuring system log verbosity level

Configuring the system log verbosity level is possible through the following env vars:

  • MONGODB_DISABLE_SYSTEM_LOG: Whether to enable/disable system log on MongoDB®. Default: false. Possible values: [true, false].
  • MONGODB_SYSTEM_LOG_VERBOSITY: MongoDB® system log verbosity level. Default: 0. Possible values: [0, 1, 2, 3, 4, 5]. For more information about the verbosity levels please refer to the MongoDB® documentation
console
docker run --name mongodb -e ALLOW_EMPTY_PASSWORD=yes -e MONGODB_SYSTEM_LOG_VERBOSITY='3' bitnami/mongodb:latest

or by modifying the docker-compose.yml file present in this repository:

yaml
services:
  mongodb:
  ...
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MONGODB_SYSTEM_LOG_VERBOSITY=3
  ...
Using numactl

In order to enable launching commands using numactl, set the MONGODB_ENABLE_NUMACTL variable to true. For more information on this, check the official [MongoDB documentation][(<[***]>)

Enabling/disabling IPv6

Enabling/disabling IPv6 is possible through the following env var:

  • MONGODB_ENABLE_IPV6: Whether to enable/disable IPv6 on MongoDB®. Default: false. Possible values: [true, false]

To enable IPv6 support, you can execute:

console
docker run --name mongodb -e ALLOW_EMPTY_PASSWORD=yes -e MONGODB_ENABLE_IPV6=yes bitnami/mongodb:latest

or by modifying the docker-compose.yml file present in this repository:

yaml
services:
  mongodb:
  ...
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MONGODB_ENABLE_IPV6=yes
  ...
Enabling/disabling directoryPerDB

Enabling/disabling directoryPerDB is possible through the following env var:

  • MONGODB_ENABLE_DIRECTORY_PER_DB: Whether to enable/disable directoryPerDB on MongoDB®. Default: true. Possible values: [true, false]
console
docker run --name mongodb -e ALLOW_EMPTY_PASSWORD=yes -e MONGODB_ENABLE_DIRECTORY_PER_DB=yes bitnami/mongodb:latest

or by mo

_Note: the README for this container is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at [***]

查看更多 mongodb 相关镜像 →
mongodb/mongodb-enterprise-server logo
mongodb/mongodb-enterprise-server
认证
MongoDB官方企业高级服务器是面向企业级应用的高性能、可扩展文档数据库服务器,支持复杂查询、分布式部署与实时数据分析,提供企业级安全特性(如身份验证、数据加密)、完善的数据备份与恢复机制及专业监控工具,助力企业构建稳定高效的现代应用架构,满足大规模数据存储、处理与业务创新需求。
141M+ pulls
上次更新:1 天前
mongodb/mongodb-atlas-local logo
mongodb/mongodb-atlas-local
认证
通过Docker创建、管理和自动化MongoDB Atlas Local资源
101M+ pulls
上次更新:2 天前
mongodb/mongodb-atlas-kubernetes-operator logo
mongodb/mongodb-atlas-kubernetes-operator
认证
MongoDB Atlas Kubernetes Operator - 基于Kubernetes原生管理MongoDB Atlas基础设施
51M+ pulls
上次更新:2 天前
mongodb/mongodb-community-server logo
mongodb/mongodb-community-server
认证
官方MongoDB社区服务器是由MongoDB公司推出的免费开源文档数据库服务,专为开发者与技术社区打造,支持以JSON格式存储灵活的非结构化及半结构化数据,具备高可扩展性、易部署性和丰富的查询功能,广泛应用于Web开发、大数据分析、移动应用后端等场景,为用户提供高效的数据管理解决方案并促进社区协作与技术交流。
17410M+ pulls
上次更新:1 天前
mongodb/mongodb-mcp-server logo
mongodb/mongodb-mcp-server
认证
官方MongoDB MCP服务器镜像,用于部署和运行MongoDB MCP服务,提供官方支持的可靠运行环境。
1100K+ pulls
上次更新:2 天前
mongodb/apix_test logo
mongodb/apix_test
认证
apix测试仓库镜像,提供测试环境下的仓库功能支持
500K+ pulls
上次更新:2 天前

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

登录仓库拉取

通过 Docker 登录认证访问私有仓库

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

Docker Compose

Docker Compose 项目配置

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

MacOS OrbStack

MacOS OrbStack 容器配置

宝塔面板

在宝塔面板一键配置镜像

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

极空间

极空间 NAS 系统配置服务

爱快路由

爱快 iKuai 路由系统配置

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

专属域名拉取

无需登录使用专属域名

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

轩辕镜像免费版与专业版有什么区别?

免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

轩辕镜像支持哪些镜像仓库?

专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
bitnami/mongodb
官方博客Docker 镜像使用技巧与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
提交工单
咨询镜像拉取问题请 提交工单,官方技术交流群:1072982923
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
咨询镜像拉取问题请提交工单,官方技术交流群:
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动
官方邮箱:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.