barcus / bareos

Docker image for Bareos
https://hub.docker.com/r/barcus
MIT License
118 stars 56 forks source link

Fix Docker Entrypoint mod #179

Open FlorentPoinsaut opened 11 months ago

FlorentPoinsaut commented 11 months ago

Hello, I suggest this modification to fix this error

$ docker run --cap-drop all --user 100:101  --rm -it barcus/bareos-storage:21-alpine sh
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/docker-entrypoint.sh": permission denied: unknown.
barcus commented 5 months ago

Hello @FlorentPoinsaut I tried to remove the chmod command from Dockerfile but at the end this file can not be executed any more ! Also with this new build i still got the same error

docker run --cap-drop all --user 100:101  --rm -it local/bareos-storage:21-alpine sh
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/docker-entrypoint.sh": permission denied: unknown.

As you can see I used bareos-storage:21-alpine as a test

barcus commented 5 months ago

entrypoint.sh script should be executable. we can solve this issue with chmod a+x instead of chmod u+x but finally user 100 or group 101 is not able to change some bareos stuff unless we force the owner of mounted volumes/files, as you can see there:

docker run --cap-drop all --user 100:101  --rm -it local/bareos-storage:21-alpine sh
touch: /etc/bareos/bareos-config.control: Permission denied
chown: /var/lib/bareos/archive: Operation not permitted
chown: /var/lib/bareos/storage: Operation not permitted
/ $