Docker-compose creates Nextcloud private network disk

table of Contents

                   surroundings

                   Install Docker, Docker-compose and configuration acceleration

                   Write a .yaml file to start and test

                   to sum up

 

surroundings

centos 7.5 192.168.253.110

Install Docker, Docker-compose and configuration acceleration

1) Configure Ali's docker source

[root@hya ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2) Install docker, docker-compose

[root@hya ~]# yum -y install docker docker-compose lrzsz
[root@hya ~]# vim /etc/docker/daemon.json
{
 "registry-mirrors": ["https://26ahzfln.mirror.aliyuncs.com"]
}

3) Start docker

[root@hya ~]# setenforce 0
[root@hya ~]# systemctl  start docker

Write a .yaml file to start and test

1) Write

[root@hya ~]# cd /usr/local/compose/
[root@hya compose]# vim docker-compose.yml 
version: "3"
services:
  mysql:
    image: bingozhou/mysql5.7         #数据库版本
    environment:
      MYSQL_ROOT_PASSWORD: 123456     #数据库Root用户密码
      MYSQL_USER: hya                 #用户
      MYSQL_PASSWORD: 123456          #密码
      MYSQL_DATABASE: nextcloud
    ports:
      - 3306:3306
    command: --character-set-server=utf8     # 编码设置为UTF8

  nextcloud:
    image: nextcloud:latest
    volumes:
      - /opt/next/data:/var/www/html/data   #网盘数据目录挂载目录,实现持久化存储
    ports:
      - 80:80

2) Start

[root@hya compose]# docker-compose up -d 
Creating compose_mysql_1     ... done
Creating compose_nextcloud_1 ... done
[root@hya compose]# docker-compose ps   #查看状态 up是成功
       Name                      Command               State           Ports         
-------------------------------------------------------------------------------------
compose_mysql_1       docker-entrypoint.sh --cha ...   Up      0.0.0.0:3306->3306/tcp
compose_nextcloud_1   /entrypoint.sh apache2-for ...   Up      0.0.0.0:80->80/tcp 

3) Test

to sum up

        Container orchestration has greatly improved our efficiency, and we must maintain a heart that we will learn to live and learn.

Guess you like

Origin blog.csdn.net/yeyslspi59/article/details/108835303