1. Install the Docker – Compose

Download the Docker-compose binary and set it to an executable state

The curl - L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname - s) - $(uname -m)" - o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-composeCopy the code
2. Install mariaDb
docker search mariadb
docker pull mariadb
Copy the code

3. Install chevereto
docker search chevereto
docker pull chevereto
Copy the code

4. Prepare Docker Compose file

Create a directory to store the docker-comemess. yml file

mkdir chevereto
touch docker-compose.yml
Copy the code

The file contents are as follows, with the dependent chevereto and Mariadb configured

version: '3'

services:
  db:
    image: mariadb
    container_name: chevereto-mysql
    Mount the mysql data volume from the container to the local database folder
    volumes:
      - ./database:/var/lib/mysql:rw
    restart: always
    networks:
      - chevereto-net
    Mysql > set mysql root password and other user
    environment:
      MYSQL_ROOT_PASSWORD: 123
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto
      MYSQL_PASSWORD: chevereto
    ports:
     - 9097: 3306

  chevereto:
    depends_on:
      - db
    image: nmtan/chevereto
    container_name: chevereto
    restart: always
    networks:
      - chevereto-net
    Set some parameters for CHEVERETO_DB
    environment:
      CHEVERETO_DB_HOST: db
      CHEVERETO_DB_USERNAME: chevereto
      CHEVERETO_DB_PASSWORD: chevereto
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_DB_PREFIX: chv_
    Mount the images folder in the container to the local chevereto_images folder, as well
    # local conf/upload. Ini configuration file mount to the container/usr/local/etc/PHP/conf. D /
    volumes:
      - ./chevereto_images:/var/www/html/images:rw
      - ./conf/upload.ini:/usr/local/etc/php/conf.d/upload.ini:ro
    # Port mapping, native: container, need to configure security group
    ports:
      - 9099: 80
networks:
  chevereto-net:
volumes:
  database:
  chevereto_images:

Copy the code
5. Start the container
docker-compose up -d
Copy the code

6. Add permissions to the images folder
docker exec -it chevereto /bin/bash
chmod 777 /var/www/html/images
Copy the code

Go into the container in which Chevereto is running and open permissions for the images directory, which will be used to hold images. If a message is displayed after chevereto is started indicating that other directories are not accessible, you can also change the chevereto file using this method.

7. The startup is successful