配置文件介绍

nextcloud的网络是macvlan,没有的可以自己创建一个macvlan,搭建成功后macvlan分配的网络可能和本地路由的IP冲突,请修改(我这里是portainer,直接修改就可以了)

配置文件

version: '3.7'

services:
  db:
    image: mariadb:latest
    container_name: nextcloud-db
    volumes:
      - nextcloud-db-data:/var/lib/mysql
    networks:
      - default
    restart: always
    environment:
      TZ: asia/shanghai
      MYSQL_ROOT_PASSWORD: supersecretpassword
      MYSQL_DATABASE: db
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpassword

  redis:
    image: redis:latest
    restart: always
    networks:
      - default
    volumes:
      - redis:/var/lib/redis

  nextcloud:
    depends_on:
      - redis
      - db
    image: nextcloud:stable 
    container_name: nextcloud
    volumes:
      - /mnt/important/docker/nextcloud:/var/www/html
    networks:
      - macvlan
      - default
    restart: always
    environment:
      REDIS_HOST: redis
      MYSQL_HOST: db:3306
      MYSQL_DATABASE: db
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpassword

networks:
  macvlan:
    external: true
    
volumes:
  nextcloud-db-data:
    name: nextcloud-db-data
  redis:
    name: nextcloud-redis

用portainer修改macvlan分配的IP

portainer01

portainer02

portainer

Last modification:March 8th, 2021 at 09:25 am
If you think my article is useful to you, please feel free to appreciate