need persistence volume for qloapps
Hello Team,
i'm working on setting up qloapps using docker. However I dont see any where in the document where it mentions what is the location to mount for application. Because we are in testing phase and we cannot keep loosing the data. I'm sharing the docker-compose for your reference.
version: '3.8'
services:
qloappsv161:
image: webkul/qloapps_docker:latest
container_name: qloappsv161
restart: always
depends_on:
- mysql
ports:
- "80:80"
- "2222:22"
environment:
USER_PASSWORD: qloappsuserpassword
MYSQL_ROOT_PASSWORD: myrootpassword
MYSQL_DATABASE: qlo161
MYSQL_USER: qloappsuser
MYSQL_PASSWORD: qloappsuserpassword
MYSQL_HOST: mysql
networks:
- qloapps_network
volumes:
- ./qloapps_data:/home/qloapps/www/QloApps # Persist application data
mysql:
image: mysql:5.7
container_name: qloapps_mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: myrootpassword
MYSQL_DATABASE: qlo161
MYSQL_USER: qloappsuser
MYSQL_PASSWORD: qloappsuserpassword
ports:
- "3306:3306"
volumes:
- ./mysql_data:/var/lib/mysql
networks:
- qloapps_network
networks:
qloapps_network:
driver: bridge
To persist QloApps data and avoid losing changes during container restarts, you need to properly mount the application directory. Currently, your docker-compose.yml mounts:
volumes:
- ./qloapps_data:/home/qloapps/www/QloApps # Persist application data
However, if qloapps_data on your host is empty, the corresponding directory inside the container will also be blank. To fix this:
Get inside the directory qloapps_data of your host
Clone QloApps Files: Run the following command on your host machine:
git clone https://github.com/Qloapps/QloApps
This ensures the necessary files exist before mounting.
Ensure the volume is mapped correctly:
volumes:
- ./qloapps_data:/home/qloapps/www/QloApps
Rebuild and Up the Containers:
docker-compose up -d
Now, any changes inside qloapps_data will persist, even if the container is stopped or removed.
or you can create a docker volume and mount that volume to the container in your docker-compose file.