• Stars
    star
    1,405
  • Rank 33,301 (Top 0.7 %)
  • Language
    Shell
  • Created almost 6 years ago
  • Updated 25 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This project contains a Docker image meant to facilitate the deployment of Nacos .

Nacos Docker

Docker Pulls

This project contains a Docker image meant to facilitate the deployment of Nacos.

中文

Note

The following environment variables have been removed from the default values in the new version(Nacos 2.2.1) for the sake of system security, please add them yourself when starting up, otherwise an error will be reported at startup.

  1. NACOS_AUTH_IDENTITY_KEY
  2. NACOS_AUTH_IDENTITY_VALUE
  3. NACOS_AUTH_TOKEN

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:latest image. For specific reasons, refer to Removing the Master-Slave Image Configuration
  • 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 database script yourself for the first time.

Quick Start

docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.2.0

Advanced Usage

  • Tips: You can change the version of the Nacos image in the compose file from the following configuration. example/.env
NACOS_VERSION=v2.2.0

Run the following command:

  • Clone project

    git clone --depth 1 https://github.com/nacos-group/nacos-docker.git
    cd nacos-docker
  • Standalone Derby

    docker-compose -f example/standalone-derby.yaml up
  • Standalone Mysql

    # 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
  • Standalone Nacos Cluster

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

    curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
    
  • Service discovery

    curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
  • Publish config

    curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
  • Get config

      curl -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:http://127.0.0.1:8848/nacos/

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 :18000
NACOS_AUTH_TOKEN Note: It is removed from Nacos 2.2.1
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 Note: It is removed from Nacos 2.2.1
NACOS_AUTH_IDENTITY_VALUE nacos.core.auth.server.identity.value Note: It is removed from Nacos 2.2.1
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

If you have a lot of custom configuration needs, It is highly recommended to mount application.properties in production environment.

For example:

docker-compose -f example/custom-application-config.yaml up -d

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

More Repositories

1

nacos-sdk-go

Nacos client in Golang
Go
1,119
star
2

nacos-examples

Nacos Examples
Java
953
star
3

r-nacos

Nacos server re-implemented in Rust.
Rust
812
star
4

nacos-spring-boot-project

Nacos ECO Project for Spring Boot
Java
785
star
5

nacos-spring-project

Nacos ECO Project for Spring Framework
Java
755
star
6

nacos-k8s

This project contains a Nacos Docker image meant to facilitate the deployment of Nacos on Kubernetes using StatefulSets.
Go
595
star
7

nacos-sdk-csharp

This nacos csharp sdk
C#
420
star
8

nacos-sdk-python

nacos python sdk
Python
362
star
9

nacos-sync

Service Sync component
Java
292
star
10

nacos-sdk-nodejs

nacos node.js sdk client
TypeScript
291
star
11

nacos-sdk-cpp

C++ client for Nacos
C++
125
star
12

nacos-sdk-rust

nacos client for rust
Rust
117
star
13

grpc-java-registry-nacos

gRPC Nacos registry integration
Java
97
star
14

nacos-group.github.io

nacos-group.github.io
MDX
97
star
15

nacos-plugin

A collection of Nacos plug-ins, providing Nacos with pluggable plug-in capabilities, support for user customization and high scalability
Java
91
star
16

nacos-coredns-plugin

Nacos DNS-F Client Based On CoreDNS
Go
83
star
17

nacos-template

nacos-template include PPT template and knote
70
star
18

nginx-nacos-upstream

nginx nacos module. subscribe service and configuration from nacos instead of modifying and reloading nginx.conf
C
61
star
19

nacos-confd

Go
40
star
20

nacos-istio

Nacos integrate with Istio as a MCP server
Go
38
star
21

nacos-controller

nacos k8s controller
Go
25
star
22

dubbo-registry-nacos

Dubbo Registry support for Nacos
14
star
23

nacos-k8s-sync

A component for sync services between Nacos and Kubernetes.
Go
12
star
24

nacos-sdk-lua

Lua
12
star
25

nacos-activity

The documents presented in nacos activities
11
star
26

nacos-sdk-php

PHP
11
star
27

nacos-ctl

The controller command sdk for nacos
Java
7
star
28

logback-adapter

Java
5
star
29

acm2nacos-spring-cloud-example

Java
4
star
30

nacos-tutorial

Nacos 知行实验仓库
2
star
31

acm2nacos-java-example

Java
2
star
32

apollo-2-nacos-migration

Apollo迁移到Nacos的脚本工程
Java
1
star
33

nacos-logo

The logo files for nacos
1
star