(编辑:jimmy 日期: 2024/12/22 浏览:2)
yum install epel-release yum install docker service docker start
curl -L http://github.com/docker/compose/releases/download/1.17.0/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
1,需要创建一个nextcloud的网络:docker create network nextcloud
[root@VM_0_3_redhat nextcloud]# docker network create nextcloud b01cd2af784023bb9deb416f6f147b883ceac3d4094b0573bcbe4fe29eb8ef7e
2,编辑docker-compose.yml文件设置镜像信息:vi docker-compose.yml
version: '2' services: db: container_name: cloud_db image: mysql volumes: - "./data/cloud/mysql:/var/lib/mysql" restart: always environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: nextcloud app: container_name: cloud_app depends_on: - db image: nextcloud volumes: - ./data/cloud/config:/var/www/html/config - ./data/cloud/data:/var/www/html/data - ./data/cloud/apps:/var/www/html/apps links: - db ports: - "2333:80" restart: always cron: container_name: cloud_cron image: nextcloud links: - db volumes_from: - app user: www-data entrypoint: | bash -c 'bash -s <<EOF trap "break;exit" SIGHUP SIGINT SIGTERM while /bin/true; do /usr/local/bin/php /var/www/html/cron.php sleep 900 done EOF' restart: always web: container_name: cloud_web image: abiosoft/caddy volumes: - ./Caddyfile:/etc/Caddyfile - ~/.caddy:/root/.caddy ports: - 80:80 - 443:443 restart: always networks: default: external: name: nextcloud
3,拉取镜像:docker-compose up -d
1,镜像拉取成功之后查看监听端口,和我们在docker-compose.yml中设置的一样2333端口监听
2,登录http://ip:2333
3,创建用户用户登录nextcloud使用,接着填写数据库信息,我们前面指定使用mysql数据库,这里填写mysql用户名密码数据库,主机名这里直接填写db就可以。最后点击安装。
4,安装完成,进入nextcloud主界面,第一次进入提示他的多客户端下载地址。
5,个人存储主界面。
6,按照docker-compose.yml配置,镜像中数据信息会保存在本地。