0

Running httpd as a service from a container, I am following this example.

docker build --rm --no-cache -t my_image .
docker run --privileged --name my_website -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d my_image

Dockerfile:

FROM centos/systemd
RUN yum -y install httpd; yum clean all; systemctl enable httpd.service
EXPOSE 80
CMD ["/usr/sbin/init"]

The first time I got it running (fresh reboot.) Then:

docker stop my_website
docker start my_website

No data received:

wget http://localhost                         
--2022-11-06 12:09:42--  http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

Rebooting the Mac and everything works until I stop/restart the container.

Here are some info about the system:

Client: Docker Engine - Community
  Version:           20.10.21
  API version:       1.41
  Go version:        go1.19.2
  Git commit:        baeda1f82a
  Built:             Tue Oct 25 17:53:02 2022
  OS/Arch:           darwin/arm64
  Context:           default
  Experimental:      true


System Software Overview:

  System Version: macOS 12.6 (21G115)
  Kernel Version: Darwin 21.6.0
John Difool
  • 5,572
  • 5
  • 45
  • 80

1 Answers1

0

add --cgroupns=host to docker run --privileged --name my_website -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d my_image I.e run the following docker run --privileged --cgroupns=host --name my_website -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d my_image

chekkal
  • 187
  • 6