docker 安装单节点 nacos

docker 安装单节点 nacos

执行步骤

# Clone 项目
git clone https://github.com/nacos-group/nacos-docker.git
cd nacos-docker

# 单机模式启动
docker-compose -f example/standalone-derby.yaml up
# 如果需要后台启动
docker-compose -f example/standalone-derby.yaml up -d

#nacos 数据是存在mysql中的,如果没有mysql 还需启动mysql
#启动mysql 5.7
docker-compose -f example/standalone-mysql-5.7.yaml up
#如果希望使用MySQL8
docker-compose -f example/standalone-mysql-8.yaml up

配置文件详解

在docker-compose.yml 中,默认会启动三容器,分别是nacos, prometheus, grafana.nacos 默认的账户密码是:

nacos/nacos, grafana 默认的账户密码是 admin/admin。

version: "2"
services:
  nacos:
    image: nacos/nacos-server:v${NACOS_VERSION}
    container_name: nacos-standalone
    environment:
      - PREFER_HOST_MODE=hostname
      - MODE=standalone
    volumes:
      - ./standalone-logs/:/home/nacos/logs
    ports:
      - "8848:8848"
      - "9848:9848"
  prometheus:
    container_name: prometheus
    image: prom/prometheus:latest
    volumes:
      - ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
    depends_on:
      - nacos
    restart: on-failure
  grafana:
    container_name: grafana
    image: grafana/grafana:latest
    ports:
      - 3000:3000
    restart: on-failure
~                          

报错解决

在执行启动nacos 服务命令时,可能会出现如下报错

$ docker-compose -f example/standalone-derby.yaml up
Creating network "example_default" with the default driver
Pulling nacos (nacos/nacos-server:vv2.2.0)...
ERROR: manifest for nacos/nacos-server:vv2.2.0 not found: manifest unknown: manifest unknown

报错原因:无法拉取到对应版本的包,

解决方案:将 example/.env 中版本的前缀去掉

$ vim  example/.env

NACOS_VERSION=v2.2.0 ===> NACOS_VERSION=2.2.0
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值