apache - Starting a service inside of a Dockerfile -
i'm building docker container , in container downloading apache service. possible automatically start apache service @ point? systemctl start httpd not work inside of dockerfile.
basically, want apache service started when docker container started.
from centos:7 maintainer me <me@me.com> run yum update -y && yum install -y httpd php run (cd /lib/systemd/system/sysinit.target.wants/; in *; [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ rm -f /lib/systemd/system/basic.target.wants/*;\ rm -f /lib/systemd/system/anaconda.target.wants/*; volume [ "/sys/fs/cgroup" ] expose 80 expose 443 cmd ["/usr/sbin/init"]
try using cmd ["/usr/sbin/httpd", "-dforeground"]
.
you can run :
docker run -d <image name> /usr/sbin/httpd -dforeground
Comments
Post a Comment