Skip to content
Nacos 配置中心安全问题汇总及解决方案 Know more

Quick Start for Nacos Docker


Run the following command:

  • Clone project

    Terminal window
    git clone
    cd nacos-docker
  • Stand-alone Derby

    Terminal window
    docker-compose -f example/standalone-derby.yaml up
  • Stand-alone MySQL

To use MySQL 5.7, run

Terminal window
docker-compose -f example/standalone-mysql-5.7.yaml up

To use MySQL 8, run

Terminal window
docker-compose -f example/standalone-mysql-8.yaml up
  • Cluster

    Terminal window
    docker-compose -f example/cluster-hostname.yaml up
  • Service registration

    Terminal window
    curl -X POST ''
  • Service discovery

    Terminal window
    curl -X GET ''
  • Publish config

    Terminal window
    curl -X POST ""
  • Get config

    Terminal window
    curl -X GET ""
  • Open the Nacos console in your browser


Common property configuration

MODEcluster/standalonecluster/standalone default cluster
NACOS_SERVERSnacos cluster addresseg. ip1
PREFER_HOST_MODEWhether hostname are supportedhostname/ip default ip
NACOS_APPLICATION_PORTnacos server portdefault 8848
NACOS_SERVER_IPcustom nacos server ip when network was mutil-network
SPRING_DATASOURCE_PLATFORMstandalone support mysqlmysql / empty default empty
MYSQL_SERVICE_PORTmysql database portdefault : 3306
MYSQL_SERVICE_DB_NAMEmysql database name
MYSQL_SERVICE_USERusername of database
MYSQL_SERVICE_PASSWORDpassword of database
MYSQL_DATABASE_NUMIt indicates the number of databasedefault :1
MYSQL_SERVICE_DB_PARAMDatabase url parameterdefault:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
JVM_XMS-Xmsdefault :1g
JVM_XMX-Xmxdefault :1g
JVM_XMN-Xmndefault :512m
default :128m
default :320m
NACOS_DEBUGenable remote debugy/n default
NACOS_AUTH_SYSTEM_TYPEThe auth system to use, currently only ‘nacos’ is supporteddefault
NACOS_AUTH_ENABLEIf turn on auth systemdefault
NACOS_AUTH_TOKEN_EXPIRE_SECONDSThe token expiration in secondsdefault :18000
NACOS_AUTH_TOKENThe default tokendefault
NACOS_AUTH_CACHE_ENABLETurn 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_LISTSet the cluster list with a configuration file or command-line argumenteg:,,
EMBEDDED_STORAGEUse embedded storage in cluster mode without mysqlembedded default : none
NACOS_AUTH_CACHE_ENABLEnacos.core.auth.caching.enableddefault : false
NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLEnacos.core.auth.enable.userAgentAuthWhitedefault : false
NACOS_AUTH_IDENTITY_KEYnacos.core.auth.server.identity.keydefault : serverIdentity
NACOS_AUTH_IDENTITY_VALUEnacos.core.auth.server.identity.valuedefault : security : /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**

Nacos + Grafana + Prometheus

Usage reference:Nacos monitor-guide

Note: When Grafana creates a new data source, the data source address must be http://prometheus:9090