Dockerfile
FROM centos:7
COPY docker-entrypoint.sh /data/
ENTRYPOINT ["/data/docker-entrypoint.sh"]
docker-entrypoint.sh
exec /usr/sbin/init && systemctl restart autofs %% python /data/myapp.py
I need to run /usr/sbin/init
as the first command then run subsequent commands such as systemctl restart autofs
and python myapp.py
I cant seem to get all working inside docker-entrypoint.sh because /usr/sbin/init
does not return
if i change docker-entrypoint.sh to
/usr/sbin/init &
systemctl restart autofs && python /data/myapp.py
it fails with error in d-bus
what can i do so the container runs /usr/sbin/init
, systemctl restart autofs
and python /data/myapp.py
in that order when "docker run" is executed?
Is there any other ways to run commands after /usr/sbin/init
is executed?
i've tried putting systemctl as CMD in Dockerfile
FROM centos:7
ENTRYPOINT ["/usr/sbin/init"]
CMD ["systemctl restart autofs"]
but CMD is never executed