I am trying to create my own Nginx image, using apline:latest image, after fixing a lot of errors, thanks to the internet, I managed to do it and everything works fine, but the problem is when I run the following command :
rc-service nginx status
* status: stopped
and when I try to start the service this is what it gives me as shown below :
rc-service nginx start
* WARNING: nginx is already starting
even though the service is stopped the output of the second command tells it is already started?!
so I opened the localhost of my docker-machine to verify whether the service is on or off, and the nginx html page appears successfully.
I tried to run rc-service nginx reload and this is the result:
rc-service nginx reload
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/blkio/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/cpu/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/cpuacct/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/cpuset/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/devices/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/freezer/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/hugetlb/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/memory/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/net_cls/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/net_prio/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/perf_event/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 100: can't create /sys/fs/cgroup/pids/tasks: Read-only file system
* nginx: cannot `reload' as it has not been started
here is the output of nginx -t :
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
and here is the output of less /var/log/nginx/error.log as shown below there is no error :
less: can't open '/var/log/nginx/error.log': No such file or directory
this is my dockerfile :
From alpine:latest
COPY nginx.conf ./tmp
COPY index.html ./tmp
COPY run.bash ./tmp
COPY run2.bash ./tmp
RUN apk update && \
apk add nginx && \
adduser -D -g 'www' www && \
mkdir /www && \
chown -R www:www /var/lib/nginx && \
chown -R www:www /www && \
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig && \
apk add openrc --no-cache && \
sh tmp/run.bash
cmd sh tmp/run2.bash
run.bash :
mv tmp/nginx.conf /etc/nginx/nginx.conf
mv tmp/index.html /www/index.html
run2.bash :
mkdir /run/openrc
touch /run/openrc/softlevel
mkdir -p /run/nginx
nginx
sh
and this is the guide that I followed :
https://wiki.alpinelinux.org/wiki/Nginx
I want to know why rc-service nginx reload doesn't work even that my nginx service is running perfectly on my docker machine, and also why rc-service nginx status tells that the nginx service is stopped even that it is not ?
and thanks in advance.
By the way when I run this command nginx -s reload, it works without any errors.