ONLYOFFICE / CommunityServer

Free open source office suite with business productivity tools: document and project management, CRM, mail aggregator.
http://www.onlyoffice.com
Apache License 2.0
2.75k stars 621 forks source link

docker container crashes after few seconds on Ubuntu 22 Server #424

Closed HoffmannTom closed 2 years ago

HoffmannTom commented 2 years ago

Hello, the community-server was working with Ubuntu 20 (ESXI-VM). After upgrading to Ubuntu 22 the container crashes after few seconds. I also tried setting up a new, stock Ubuntu 22 via virtualBox. I installed docker.io and tried to run:

docker run -i -t -d --privileged --name onlyoffice-community-server -p 9080:80 -p 4433:443 -p 5229:5222 \ -e ONLYOFFICE_HTTPS_HSTS_ENABLED=false \ -e MYSQL_SERVER_HOST=192.168.1.41 \ -e MYSQL_SERVER_PORT=3306 \ -e MYSQL_SERVER_DB_NAME=onlyoffice \ -e MYSQL_SERVER_USER=mysql_onlyoffice \ -e MYSQL_SERVER_PASS=#### \ -e MYSQL_SERVER_EXTERNAL=true \ -e DOCKER_ENABLED=true \ -e CONTROL_PANEL_PORT_80_TCP=80 \ -e CONTROL_PANEL_PORT_80_TCP_ADDR=onlyoffice-control-panel \ -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \ -v /app/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/CommunityServer/letsencrypt:/etc/letsencrypt \ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ onlyoffice/communityserver

with the same result, the container crashes after few seconds. Within the docker log, I can only find the error "System has not been booted with systemd as init system (PID 1). Can't operate." but this message was already there with Ubuntu 20. So I don't think that this is the reason.

Has anyone successfully ran the docker image on Ubuntu 22? Where else can I search for the crash reason?

Thanks in advance! Thomas

Carazyda commented 2 years ago

Hello @HoffmannTom please try changing this parameter: -v /sys/fs/cgroup:/sys/fs/cgroup:rw

HoffmannTom commented 2 years ago

Hello @Carazyda , I already read that suggestion and tried it but without success. I couldn't see any difference. The tail of the log is:

+ systemctl daemon-reload
System has not been booted with systemd as init system (PID 1). Can't operate.
+ systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.
+ '[' -n '' ']'
+ rm -dfr '/tmp/onlyoffice*'
+ rm -dfr '/var/run/onlyoffice/*'
+ rm -dfr '/var/cache/nginx/onlyoffice/*'
+ '[' false == true ']'

Just out of curiosity: Is there a certain reason why systemd is used? All containers I worked with, used a start-script and started one process. I think that's also the recommendation when building containers.

The warning about missing systemd appeared also with Ubuntu 20 but onlyoffice worked despite. Docker comes in version 20.10.12 with Ubuntu 22. Any other ideas or locations I can take a look at?

Carazyda commented 2 years ago

Please also add this parameter to docker run command --cgroupns=host.

HoffmannTom commented 2 years ago

Thanks for the hint! The container doesn't crash anymore. Unfortunately, my newly created VM doesn't have a proper environment (firewall configuration etc.). I will try to upgrade the ubuntu 20 system in the next few days and add the suggested parameters.

The log only shows one error which looks like related to network: /app/run-community-server.sh: line 185: & 255 : syntax error: operand expected ( error token is "& 255 ")

It seems to have problems with the IP shown some lines above: " ++ echo 172.17.0.0/16"

Not sure if this causes any further problems. I will report the result for the ubuntu 20 upgrade ...

HoffmannTom commented 2 years ago

Hello @Carazyda the parameter cgroupns is unfortunately not available for docker-compose (or did I miss that parameter?). What worked for me was to set this parameter globally at docker-daemon level via daemon.json: { "default-cgroupns-mode" : "host" }

After restarting the daemon, the community-server started successfully and everything works now. Thank you very much for your support!

Carazyda commented 2 years ago

Hello @HoffmannTom Yes, we have a problem with running docker-compose method on Ubuntu 22.04(Bug 58578 in our private bugtracker).

"default-cgroupns-mode" : "host"

This is one of the solutions to this problem. I'm glad that it helped you and everything works.

jonpage999 commented 2 years ago

Yes, we have a problem with running docker-compose method on Ubuntu 22.04(Bug 58578 in our private bugtracker).

Why. Is. This. Not. Documented. In. Your. Docker. Compose. Repository. READMEs!?!?

I've just spent two days trying to get this running, to finally discover several issues where you're telling people you know you have an issue with the latest version of Ubuntu. Tell people, so we don't waste out time. This is the kind of nonsense that will lose you customers. I was interested. Now I'm just extremely frustrated.

Carazyda commented 2 years ago

Hello @jonpage999 We apologize for wasting your time. Didn't expect this installation method to be so popular. We consider the installation by our script to be the main method. We have added a hint to the instructions. Now you can use our script to install. Or use the workaround above.

VincentSC commented 1 year ago

Ubuntu 22.04 is an LTS release, like 20.04. So We normally upgrade to the next LTS 6+ months after initial release - this is a quite common upgrade-process (with different details) as most issues are fixed in those 6 months. I personally had 0 clue that a Docker could be failing with a different Linux-host...

Also important: I would really like to have none of my dockers run in privileged mode!

Have you looked into https://github.com/gdraheim/docker-systemctl-replacement ? That's a systemctl rewrite that does not need a privileged docker. It would solve everything, I think.