Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use bind volumes #114

Open
tiritibambix opened this issue May 22, 2024 · 4 comments
Open

Can't use bind volumes #114

tiritibambix opened this issue May 22, 2024 · 4 comments

Comments

@tiritibambix
Copy link

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.

@ianc125
Copy link

ianc125 commented Jun 2, 2024

Same issue here

@Mohamed-sobhi95
Copy link

same

@gizmocuz
Copy link

Same, that's odd... never had a problem with local volumes... and it's easy to backup/deploy

@paberr
Copy link

paberr commented Dec 22, 2024

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:

docker/Dockerfile

Lines 48 to 51 in 77a1312

RUN mkdir -p /var/www/akaunting \
&& curl -Lo /tmp/akaunting.zip 'https://akaunting.com/download.php?version=latest&utm_source=docker&utm_campaign=developers' \
&& unzip /tmp/akaunting.zip -d /var/www/html \
&& rm -f /tmp/akaunting.zip

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 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants