一、docker簡單安裝nacos、使用默認的Derby數據庫
1、老規則咱們登錄docker 官網搜索nacos再到鏡像執行拉取。我這里使用默認命令
docker pull nacos/nacos-server
2、創建本地的映射文件,custom.properties,
mkdir -p /root/nacos/init.d /root/nacos/logs touch /root/nacos/init.d/custom.properties
在文件中寫入以下配置
management.endpoints.web.exposure.include=*
3、創建容器並啟動提供a、b兩種方案
a、創建容器:使用standalone
模式並開放8848
端口,並映射配置文件和日志目錄,數據庫默認使用 Derby
docker run -d -p 8848:8848 -e MODE=standalone -e PREFER_HOST_MODE=hostname -v /root/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties -v /root/nacos/logs:/home/nacos/logs --restart always --name nacos nacos/nacos-server
啟動容器,命令中:68a1f5afd98是容器id
docker start 68a1f5afd98
或者
docker start nacos
訪問:localhost:8848/nacos