Can't use bind volumes
After having the same issue as #111 , I tried using only docker volumes and it worked.
I would like to be able to use volumes like this:
version: '3.7'
services:
akaunting:
container_name: akaunting
image: docker.io/akaunting/akaunting:latest
build:
context: .
ports:
- 1261:80
volumes:
- /PATH/TO/PERSISTENT/DATA/ON/MY/DRIVE/akaunting-data:/var/www/html
restart: unless-stopped
env_file:
- env/run.env
environment:
- AKAUNTING_SETUP
depends_on:
- akaunting-db
akaunting-db:
container_name: akaunting-db
image: mariadb
volumes:
- /PATH/TO/PERSISTENT/DATA/ON/MY/DRIVE/akaunting-db:/var/lib/mysql
restart: unless-stopped
env_file:
- env/db.env
#volumes:
# akaunting-data:
# akaunting-db:
How can I achieve that @MohammedAl-Mahdawi ? Thanks for your help.
Same issue here
same
Same, that's odd... never had a problem with local volumes... and it's easy to backup/deploy
The problem that occurs is that the bind volume isn't mounted during the build process.
Thus, when running the container and mounting the (empty) bind volume, the /var/www/html directory is empty.
These lines in the Dockerfile basically have no effect but are required: https://github.com/akaunting/docker/blob/77a1312c38ac3ad51be3c5f2528ce8a40598cb0d/Dockerfile#L48-L51
A simple workaround is to initialise the bind mount manually, i.e., execute these commands (don't forget to update the path):
curl -Lo /tmp/akaunting.zip 'https://akaunting.com/download.php?version=latest&utm_source=docker&utm_campaign=developers'
unzip /tmp/akaunting.zip -d <path to your bind volume>
rm -f /tmp/akaunting.zip