Docker with docker-compose
git clone https://github.com/fr0tt/benotes_docker-compose .orwget https://raw.githubusercontent.com/fr0tt/benotes_docker-compose/master/docker-compose.yml && wget https://raw.githubusercontent.com/fr0tt/benotes_docker-compose/master/.env.exampledownload a docker-compose.yml and .env file
cp .env.example .env"enable" the .env file to be detected/used by docker-compose
- optional: only change in your
.envfileAPP_PORTif you wish to run this app under a different port docker compose up -dstart docker container
docker compose exec --user application app shaccess the app service
php artisan installamongst others: create an admin account. Type yes if asked.
docker compose pull && docker compose up -dRestart the docker container and fetch a new image if available
The docker-compose file uses a named volume to persist data. The reason for that is that bind mounts are more error-prone when it comes to permissions and terrible when it comes to inserting data beforehand.
However if you must use bind mounts do the following:
- change the docker-compose file by (un)comment this section
volumes:
- .env:/var/www/.env
- ./data/storage/app/public/thumbnails:/var/www/storage/app/public/thumbnails
- ./data/storage/backup:/var/www/storage/backup
- ./data/storage/logs:/var/www/storage/logs
#- benotes_storage:/var/www/storagemkdir -p data/storagedocker compose exec app shaccess app container as root
chown -R www-data:www-data storage && chmod -R 774 storageMake this directory writable for the webserver
Short answer: You only have to make sure that the storage directory is owned by www-data (see Volume section above).
Long answer: If you keep your existing docker-compose.yml you are going to use bind mounts which should not be a problem for you since it had to work so far and the new image uses the same exact paths as before. Also you are going to use MySQL instead of PostgreSQL but that should not be a problem either.
However if you would like to adapt and use the new docker-compose.yml file you need to start the container once before you use it to let the docker engine create and bootstrap the volume for you. After that you can copy all subfolders of data into the newly created volume which might be located at /var/lib/docker/volumes/yourBenotesInstallationDirectoryName_benotes_storage/_data - next to the database volume. (You can also use docker volume ls and docker volume inspect to locate it.)

