# 编辑 docker-compose.yml
version: "3"
services:
nacos-server:
image: nacos/nacos-server:1.3.2
container_name: nacos
hostname: nacos
restart: always
environment:
- MODE=standalone
- TZ=Asia/Shanghai
- NACOS_SERVER_PORT=8848
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_SERVICE_HOST=ip
- MYSQL_SERVICE_PORT=3306
- MYSQL_SERVICE_DB_NAME=config
- MYSQL_SERVICE_USER=root
- MYSQL_SERVICE_PASSWORD=123456
- PREFER_HOST_MODE=hostname
volumes:
- ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
- ./data/:/home/nacos/data
ports:
- 8848:8848
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
启动
docker-compose up -d
1
会报错,删除 init.d
下的 custom.properties
文件夹,然后vi custom.properties
# 添加内容
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 在重新启动,然后访问
http://127.0.0.1:8848/nacos/
注:从 0.8.0 版本开始,需要登录才可访问,默认账号密码为 nacos/nacos