
nacos/nacos-server
用于简化Nacos服务部署的Docker镜像,支持单机和集群模式,提供便捷的环境变量配置、快速启动及自定义数据库集成,适用于服务发现与配置管理场景。
让 AI 帮你使用轩辕镜像? · 展开查看说明 · 点击收起说明
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Nacos Docker
This project contains a Docker image meant to facilitate the deployment of https://github.com/alibaba/nacos.
中文
Project directory
- build:Nacos makes the source code of the docker image
- env: Environment variable file for compose yaml
- example: Docker compose example for Nacos server
Precautions
- The database master-slave image has been removed, after the latest
nacos/nacos-server:latestimage. For specific reasons, refer to https://github.com/nacos-group/nacos-docker/wiki/移除数据库主从镜像配置 - Since Nacos 1.3.1 version, the database storage has been upgraded to 8.0, and it is backward compatible
- If you use a custom database, you need to initialize the https://github.com/alibaba/nacos/blob/develop/distribution/conf/nacos-mysql.sql yourself for the first time.
Quick Start
shelldocker run --name nacos-quick -e MODE=standalone -p 8849:8848 -d nacos/nacos-server:2.0.2
Advanced Usage
- Tips: You can change the version of the Nacos image in the compose file from the following configuration.
example/.env
dotenvNACOS_VERSION=2.0.2
Run the following command:
-
Clone project
powershellgit clone --depth 1 https://github.com/nacos-group/nacos-docker.git cd nacos-docker -
Standalone Derby
powershelldocker-compose -f example/standalone-derby.yaml up -
Standalone Mysql
powershell# Using mysql 5.7 docker-compose -f example/standalone-mysql-5.7.yaml up # Using mysql 8 docker-compose -f example/standalone-mysql-8.yaml up -
Cluster
powershelldocker-compose -f example/cluster-hostname.yaml up -
Service registration
powershellcurl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080' -
Service discovery
powershellcurl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=nacos.naming.serviceName' -
Publish config
powershellcurl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld" -
Get config
powershellcurl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test" -
Open the Nacos console in your browser
link:[***]
Common property configuration
| name | description | option |
|---|---|---|
| MODE | cluster/standalone | cluster/standalone default cluster |
| NACOS_SERVERS | nacos cluster address | eg. ip1:port1 ip2:port2 ip3:port3 |
| PREFER_HOST_MODE | Whether hostname are supported | hostname/ip default ip |
| NACOS_APPLICATION_PORT | nacos server port | default 8848 |
| NACOS_SERVER_IP | custom nacos server ip when network was mutil-network | |
| SPRING_DATASOURCE_PLATFORM | standalone support mysql | mysql / empty default empty |
| MYSQL_SERVICE_HOST | mysql host | |
| MYSQL_SERVICE_PORT | mysql database port | default : 3306 |
| MYSQL_SERVICE_DB_NAME | mysql database name | |
| MYSQL_SERVICE_USER | username of database | |
| MYSQL_SERVICE_PASSWORD | password of database | |
| MYSQL_DATABASE_NUM | It indicates the number of database | default :1 |
| MYSQL_SERVICE_DB_PARAM | Database url parameter | default : characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false |
| JVM_XMS | -Xms | default :1g |
| JVM_XMX | -Xmx | default :1g |
| JVM_XMN | -Xmn | default :512m |
| JVM_MS | -XX:MetaspaceSize | default :128m |
| JVM_MMS | -XX:MaxMetaspaceSize | default :320m |
| NACOS_DEBUG | enable remote debug | y/n default :n |
| TOMCAT_ACCESSLOG_ENABLED | server.tomcat.accesslog.enabled | default :false |
| NACOS_AUTH_SYSTEM_TYPE | The auth system to use, currently only 'nacos' is supported | default :nacos |
| NACOS_AUTH_ENABLE | If turn on auth system | default :false |
| NACOS_AUTH_TOKEN_EXPIRE_SECONDS | The token expiration in seconds | default :*** |
| NACOS_AUTH_TOKEN | The default token | default :SecretKey012345678901234567890123456789012345678901234567890123456789 |
| NACOS_AUTH_CACHE_ENABLE | Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. | default : false |
| MEMBER_LIST | Set the cluster list with a configuration file or command-line argument | eg:192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809 |
| EMBEDDED_STORAGE | Use embedded storage in cluster mode without mysql | embedded default : none |
| NACOS_AUTH_CACHE_ENABLE | nacos.core.auth.caching.enabled | default : false |
| NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE | nacos.core.auth.enable.userAgentAuthWhite | default : false |
| NACOS_AUTH_IDENTITY_KEY | nacos.core.auth.server.identity.key | default : serverIdentity |
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | default : security |
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** |
Advanced configuration
If the above property configuration list does not meet your requirements, you can mount the custom.properties file into the /home/nacos/init.d/ directory of the container, where the spring properties can be configured, and the priority is higher than application.properties file
Reference example: cluster-hostname.yaml
Nacos + Grafana + Prometheus
Usage reference:Nacos monitor-guide
Note: When Grafana creates a new data source, the data source address must be [*]
Deployment & Usage Documentation
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 nacos-server 镜像标签
DockerHub 原生拉取命令
镜像拉取常见问题
功能
错误码
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务
