Working Notes: SYS265: Docker Project - eliminmax/cncs-journal GitHub Wiki
eliminmax/gitea-docker-compose
SYS-265: Buildingdocker-compose.yml is adapted from the following:
I modified docker-compose.yml to ensure that it did not have the UID, GID, or Database Password hard-coded in as 1000
, 1000
, and gitea
, respectively
- it instead uses the
$UID
,$GID
, and$DB_PW
docker-compose environment variables, which can be defined with the-e VAR=value
command-line flag, or in an env file, which can be specified with the--env-file file.env
flag, but an env file simply called .env will be applied automatically.
Additionally, I added the .gitignore files to the config/, data/, and ./postgres folders, so that I wouldn't accidentally upload their contents. As it turns out, that was a mistake. The postgres installation saw that there was already a file (.gitignore in /var/lib/postgresql/data, which was mapped from ./postgres, and exited during initial setup, but not before changing the owner and permissions of ./postgres so that I couldn't do anything with it. I saw that there were potential permissions issues if the docker service's environment:
did not include the USER_UID
and USER_GID
values, so I thought that the failure was because I was using a user with the UID and GID 1001 on the host system, and got stuck when changing the USER_UID
and USER_GID
variables to 1001
did not work - especially confusing given that I got it to work once before trying to record a video of it to submit for my project, and cleared the aforementioned folders with $ sudo rm -rf config/* data/* postgres/*
, before having the idea to add those .gitignore files.
When I finally did find the source of the problem, fixing it was as simple as changing one line in docker-compose.yml from ./postgres:/var/lib/postgresql/data
to ./postgres/data:/var/lib/postgresql/data
in docker-compose.yml (line 41, the last line in the document).