如果没有安装过docker 先安装docker
yum install docker-latest curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
拉取镜像
systemctl start docker-latest.service docker pull mariadb:latest docker pull nmtan/chevereto:latest
使用docker-compose 来启动服务
mkdir cheverto/ cd cheverto touch docker-compose.yaml
文件内容如下
version: '3' services: db: image: mariadb volumes: - database:/var/lib/mysql:rw restart: always networks: - private environment: MYSQL_ROOT_PASSWORD: chevereto_root MYSQL_DATABASE: chevereto MYSQL_USER: chevereto MYSQL_PASSWORD: chevereto chevereto: depends_on: - db image: nmtan/chevereto restart: always networks: - private environment: CHEVERETO_DB_HOST: db CHEVERETO_DB_USERNAME: chevereto CHEVERETO_DB_PASSWORD: chevereto CHEVERETO_DB_NAME: chevereto CHEVERETO_DB_PREFIX: chv_ volumes: - chevereto_images:/var/www/html/images:rw ports: - 8888:80 networks: private: volumes: database: chevereto_images:
nohup docker-compose up &> run.log & disown
完成
参考资料https://www.jianshu.com/p/7863fcb34aed