Docker with docker-compose
git clone https://github.com/fr0tt/benotes_docker-compose .or
wget https://raw.githubusercontent.com/fr0tt/benotes_docker-compose/master/docker-compose.yml && wget https://raw.githubusercontent.com/fr0tt/benotes_docker-compose/master/.env.example
download 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
APP_PORTif you wish to run this app under a different port
docker compose up -d
start docker container
docker compose exec --user application app sh
access the app service
php artisan install
amongst others: create an admin account. Type yes if asked.
docker compose pull && docker compose up -d
Restart 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/storage
mkdir -p data/storage
docker compose exec app sh
access app container as root
chown -R www-data:www-data storage && chmod -R 774 storage
Make 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.)