最完整的 Docker 搭建 Nextcloud 教程
新版本docker-compose安装文件
version: "2.1" services: nextcloud: image: lscr.io/linuxserver/nextcloud:latest container_name: nextcloud environment: - PUID=1000 - PGID=1000 - TZ=Asia/Shanghai - MYSQL_HOST=mysql - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_PASSWORD=nextcloud volumes: - /root/data/docker_data/nextcloud/config:/config - /root/data/docker_data/nextcloud/data:/data ports: - 4433:443 restart: unless-stopped mysql: image: mysql:8.0 container_name: nextcloud-db restart: unless-stopped environment: - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_PASSWORD=nextcloud - MYSQL_ROOT_PASSWORD=nextcloud volumes: - /root/data/docker_data/nextcloud/db:/var/lib/mysql
旧版本docker-compose安装文件
version: "3" services: nextcloud: container_name: nextcloud-app image: nextcloud:latest restart: unless-stopped ports: - 8080:80 environment: - MYSQL_HOST=mysql - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_PASSWORD=nextcloud volumes: - /root/data/docker_data/nextcloud/data:/var/www/html mysql: image: mysql:8.0 container_name: nextcloud-db restart: unless-stopped environment: - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_PASSWORD=nextcloud - MYSQL_ROOT_PASSWORD=nextcloud volumes: - /root/data/docker_data/nextcloud/db:/var/lib/mysql
然后执行
docker-compose up -d