i am not new to docker but i mostly work with prebuilt images, that i connect using docker-compose. I need a super-basic container, that only reads log files and streams the contents to stdout because i have permission issues in another container.
See: https://github.com/webdevops/Dockerfile/issues/332
Anyway - i fail at the very first step and dont know whats the problem
Here is my Dockerfile:
FROM alpine:latest
COPY readlogs.sh /root/readlogs.sh
CMD ['/root/readlogs.sh']
The sheel script looks like this (at the moment - i am testing)
#!/usr/bin/env bash
echo "hello world"
#cat /dev/null > /var/log/app/error.log
#cat /dev/null > /var/log/app/debug.log
#tail -f /var/log/app/error.log > /dev/stderr &
#tail -f /var/log/app/debug.log > /dev/stdout &
As you see i want to truncate some log file and then just read it continously.
Building the image works fine, starting it results in:
/bin/sh: [/root/readlogs.sh]: not found
exited with code 127
NO - the line endings are not DOS.
My docker-compose.yml
logreader:
build:
context: docker/logreader
dockerfile: Dockerfile
volumes:
- ./var/logs:/var/log/app
So - why the funk cant i execute the readlogs.sh file?
The file is executeable (on the host), i tried adding RUN chmod +x /root/readlogs.sh
but it did not work either.