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

Bind html to a directory doesn't work #44

Open
C-Fu opened this issue Apr 28, 2021 · 3 comments · May be fixed by #52
Open

Bind html to a directory doesn't work #44

C-Fu opened this issue Apr 28, 2021 · 3 comments · May be fixed by #52

Comments

@C-Fu
Copy link

C-Fu commented Apr 28, 2021

My docker-compose file:
version: '3.3' services: grav: build: ./ container_name: grav ports: - '880:80' restart: always volumes: - '/root/grav/html:/var/www/html' image: 'grav:latest' networks: default: name: test_net
If I run docker-compose up -d, or up --force-recreate --build -d, the html folder is always empty... resulting in a Forbidden error in the browser.

@Isotop7
Copy link

Isotop7 commented May 27, 2021

Sadly you can't use bind mounted host dirs because of the docker/mount mechanics:

moby/moby#4361

You really have to use a docker volume as shown in the README.md

@C-Fu
Copy link
Author

C-Fu commented Jun 5, 2021

@Isotop7 that's really strange. It works with every other container. Why wouldn't that work with grav?
Example:

`#NginxProxy

version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
ports:
- '180:80'
- '181:81'
- '1443:443'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "npm"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
db:
image: 'jc21/mariadb-aria:latest'
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
volumes:
- ./data/mysql:/var/lib/mysql`

`version: '3.3'
services:
organizr:
container_name: organizr
volumes:
- ./config:/config
environment:
- PGID=1000
- PUID=1000
- branch=v2-master
ports:
- '380:80'
image: organizr/organizr

networks:
default:
name: test_net`

@disgustipated
Copy link

Did you find a fix for this? I can build the image but nothing is being created in the volume specified. I have plenty other containers that are using the host file system volume mounts

fanks4 added a commit to fanks4/docker-grav that referenced this issue Mar 18, 2023
I found another way to install grav by populating user dir if empty during container start.
Therefore i skip user dir during build. A script will then populate /var/www/user as described in README.md
This commit also includes https://github.com/Freiheitswolke/docker-grav/tree/fix/volume and some changes to README.md to reflect the changed volumes.
The commit will not break the old way with a mount for the whole '/var/www/html' for those who want to upgrade grav via the admin console.
Building or pulling the container image with the new version of grav is a more proper way to perform upgrades in my opinion.

Closes getgrav#44
@fanks4 fanks4 linked a pull request Mar 19, 2023 that will close this issue
ntonnaett pushed a commit to ntonnaett/docker-grav that referenced this issue Aug 26, 2023
I found another way to install grav by populating user dir if empty during container start.
Therefore i skip user dir during build. A script will then populate /var/www/user as described in README.md
This commit also includes https://github.com/Freiheitswolke/docker-grav/tree/fix/volume and some changes to README.md to reflect the changed volumes.
The commit will not break the old way with a mount for the whole '/var/www/html' for those who want to upgrade grav via the admin console.
Building or pulling the container image with the new version of grav is a more proper way to perform upgrades in my opinion.

Closes getgrav#44
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

Successfully merging a pull request may close this issue.

3 participants