目录
一、安装docker
(一)更新包列表和安装依赖项
(二)添加Docker的官方GPG密钥
(三)添加Docker存储库
(四)安装Docker
(五)启动Docker服务并设置它随系统启动
(六)验证Docker安装是否成功,运行以下命令:
(七)将用户添加到docker组
二、docker运行onlyoffice,并配置https访问
(一)启动docker容器
(二)配置ssl证书
(三)重启docker容器
三、报错the document could not be saved
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
注意这一步网络如果有问题的话,容易报错。
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
sudo docker --version
这将显示已安装的Docker版本信息。为了能够在不使用sudo的情况下运行Docker命令,你可以将你的用户添加到docker组:
sudo usermod -aG docker $USER
sudo docker run -i -t -d -p 443:443 --name=onlyoffice --restart=always -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver
将onlyoffice.key和onlyoffice.crt格式的证书放到宿主机的/app/onlyoffice/DocumentServer/data/certs/目录下,注意证书文件名称一定是onlyoffice.key和onlyoffice.crt,否则启动报错,或者进入docker容器中,将nginx的配置文件的证书名称改掉。
sudo docker restart onlyoffice
the document could not be saved,please check connection settings or concat your administrator.
进入docker查日志:
sudo docker exec -it onlyoffice /bin/bash
tail -f /var/log/onlyoffice/documentserver/docservice/out.log
[2023-11-15T11:42:30.934] [ERROR] [localhost] [192.168.101.26new__1_.xlsx1700048549299] [uid-1] nodeJS - postData error: url = https://192.168.101.111/example/track?filename=new%20(1).xlsx&useraddress=192.168.101.26;data = {"key":"192.168.101.26new__1_.xlsx1700048549299","status":1,"users":["uid-1"],"actions":[{"type":1,"userid":"uid-1"}],"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiIxOTIuMTY4LjEwMS4yNm5ld19fMV8ueGxzeDE3MDAwNDg1NDkyOTkiLCJzdGF0dXMiOjEsInVzZXJzIjpbInVpZC0xIl0sImFjdGlvbnMiOlt7InR5cGUiOjEsInVzZXJpZCI6InVpZC0xIn1dLCJpYXQiOjE3MDAwNDg1NTAsImV4cCI6MTcwMDA0ODg1MH0.o1kkVun-SGl3MgM-SoPsGn_Rbw3-SagZQvneoZ8ENpM"} Error: self signed certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)
at TLSSocket.emit (events.js:400:28)
at TLSSocket._finishInit (_tls_wrap.js:937:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12)
可以看到报错原因是:Error: self signed certificate
解决方案:
将/etc/onlyoffice/documentserver/default.json文件中的rejectUnauthorized字段值改为false
重启docker容器