mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Failed to start the apache2 service on deepin apricot container started by x11docker. #320

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

I started the hongyizhao/deepin-wine:apricot docker image with x11docker, and try to install the apache2 package in the container. But I find the following error:

$ sudo apt-get install apache2
[...]
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2021-01-24 21:56:21 CST; 9ms ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 12451 ExecStart=/usr/sbin/apachectl start (code=exited, status=226/NAMESPACE)

Jan 24 21:56:21 320a7a91cca4 systemd[1]: Starting The Apache HTTP Server...
Jan 24 21:56:21 320a7a91cca4 systemd[12451]: apache2.service: Failed to set up mount namespacing: Permission denied
Jan 24 21:56:21 320a7a91cca4 systemd[12451]: apache2.service: Failed at step NAMESPACE spawning /usr/sbin/apachectl: Permission denied
Jan 24 21:56:21 320a7a91cca4 systemd[1]: apache2.service: Control process exited, code=exited, status=226/NAMESPACE
Jan 24 21:56:21 320a7a91cca4 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 24 21:56:21 320a7a91cca4 systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for systemd (241.7.1+c2-2+dde) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28.8.1-1+dde) ...

Any hints for this problem?

Regards, HY

mviereck commented 3 years ago

It seems the container misses some privileges:

Jan 24 21:56:21 320a7a91cca4 systemd[12451]: apache2.service: Failed to set up mount namespacing: Permission denied

Compare chapter troubleshooting in the README on how to detect the missing privileges: https://github.com/mviereck/x11docker#privilege-checks Maybe you find hints if you search the net for keywords apache docker container.

hongyi-zhao commented 3 years ago

It seems that running an apache2 server in docker container is a tricky thing. A simple search on google with apache docker github will give many relevant projects, say, this one. And each of them involves very complex steps. Therefore, I draw the conclusion that it is impossible to set up the Apache2 server simply by running the package installation command in a Docker container.