leftso 206 0 2022-04-30
nacos使用docker进行单机快速部署,适用于开发环境和测试环境。
nacos
nacos

准备环境

  • Linux (Ubuntu )
  • docker
  • docker-compose
相关文章:

编写nacos的docker配置文件

docker-compose.yml:
独立网络部署:
version: "3.8"


services:
  nacos:
    image: nacos/nacos-server:1.4.2
    container_name: nacos
    hostname: nacos
    restart: always
    ports: 
     - 8848:8848
    volumes:
      - ./data:/home/nacos/data
    environment:
     - MODE=standalone
     
    deploy:
      resources:
        limits:
          memory: 1024M
     

加入已有my-network网络
version: "3.8"

networks: 
  my-network: 
    external: true #外部网络

services:
  nacos:
    image: nacos/nacos-server:1.4.2
    container_name: nacos
    hostname: nacos
    restart: always
    ports: 
     - 8848:8848
    networks:
      my-network:
        aliases:
         - nacos.server
    volumes:
      - ./data:/home/nacos/data
    environment:
     - MODE=standalone
     
    deploy:
      resources:
        limits:
          memory: 1024M
     

启动nacos

cd /path/to/配置文件目录
sudo docker-compose up -d

更多配置参考:nacos/nacos-server - Docker Image | Docker Hub
 

评论区域