使用DOCKER COMPOSE搭建一个nextcloud服务
1.创建一个空的项目目录并切换到该项目目录
[root@localhost ~]# mkdir my_nextcloud ; cd my_nextcloud ; pwd/root/my_nextcloud
2.创建Docker-compose文件
version: "3.9"services:db:image: mysql:latestvolumes:- ./nc_db:/var/lib/mysqlnetworks:- nc_netports:- "3306:3306"restart: alwaysenvironment:MYSQL_ROOT_PASSWORD: nextcloudMYSQL_DATABASE: nextcloudMYSQL_USER: nextcloudMYSQL_PASSWORD: nextcloudapp:depends_on:- dbimage: nextcloud:latestvolumes:- ./nc_data:/var/www/htmlnetworks:- nc_netports:- "8888:80"restart: alwaysvolumes:nc_db: {}nc_data: {}networks:nc_net:name: nc_net
3.运行docker-compose
[root@localhost my_nextcloud]# docker-compose up -dCreating network "nc_net" with the default driverCreating volume "my_nextcloud_nc_db" with default driverCreating volume "my_nextcloud_nc_data" with default driverPulling db (mysql:latest)...latest: Pulling from library/mysql72a69066d2fe: Already exists93619dbc5b36: Already exists99da31dd6142: Already exists626033c43d70: Already exists37d5d7efb64e: Already existsac563158d721: Already existsd2ba16033dad: Already exists688ba7d5c01a: Pull complete00e060b6d11d: Pull complete1c04857f594f: Pull complete4d7cfa90e6ea: Pull completee0431212d27d: Pull completeDigest: sha256:e9027fe4d91c0153429607251656806cc784e914937271037f7738bd5b8e7709Status: Downloaded newer image for mysql:latestPulling app (nextcloud:latest)...latest: Pulling from library/nextclouda2abf6c4d29d: Already existsc5608244554d: Already exists2d07066487a0: Already exists1b6dfaf1958c: Already exists32c5e6a60073: Already exists90cf855b27cc: Already exists8b0f1068c586: Already exists53530861540e: Pull completeb088256e8218: Pull complete29c48e642f3d: Pull completebebfd59a832e: Pull complete3c07d6be5322: Pull complete52a174ca2213: Pull complete2db451f4f766: Pull complete462c9168620c: Pull complete5f6a7ae88b1d: Pull complete8507904d39d6: Pull completef6dc5bb9d193: Pull completed57202c49578: Pull complete57f778f1c66e: Pull completeDigest: sha256:bd3406506335b6621b1eb7a3d897654ac7963e3db4b91cbea3436f159655d0baStatus: Downloaded newer image for nextcloud:latestCreating my_nextcloud_db_1 ... doneCreating my_nextcloud_app_1 ... done


