【发布时间】:2021-11-09 23:40:47
【问题描述】:
我在 Raspberry Pi 上的 docker 容器中运行 nextcloud。我已经按照here 的描述设置了自签名证书。这些是我运行 docker-compose 的文件:
Dockerfile:
FROM nextcloud:apache
COPY setssl.sh /usr/local/bin/
RUN /usr/local/bin/setssl.sh mail@mail.com 172.30.0.2
码头工人撰写:
version: '2'
services:
nextcloud:
image: nextcloud_ssl
build: .
container_name: nextcloud
restart: always
user: 1000:1000
ports:
- 8443:443
volumes:
- /home/pi/nextcloud/ncdata:/var/www/html
- /home/pi/nextcloud/ssl:/etc/ssl/nextcloud
- /home/pi/pictures:/var/www/html/data/files/pics
- ./php.ini:/usr/local/etc/php/conf.d/zzz-custom.ini
environment:
- MYSQL_PASSWORD=xxx
- MYSQL_DATABASE=xxx
- MYSQL_USER=xxx
- MYSQL_HOST=xxx
- MYSQL_PORT=xxx
networks:
default:
external:
name: mariabridge
setssl.sh
# setssl.sh
# USAGE: setssl.sh <email> <domain>
echo 'SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
SSLCompression off
SSLSessionTickets Off' > /etc/apache2/conf-available/ssl-params.conf
echo "<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin $2
ServerName $1
" > /etc/apache2/sites-available/default-ssl.conf
echo '
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/nextcloud/cert.pem
SSLCertificateKeyFile /etc/ssl/nextcloud/key.pem
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>' >> /etc/apache2/sites-available/default-ssl.conf
a2enmod ssl >/dev/null
a2ensite default-ssl >/dev/null
a2enconf ssl-params >/dev/null
根据上面的链接线程,我必须运行这些命令来更新我的容器:
docker-compose build --pull
docker-compose up -d
我之前已经成功使用过这个。现在,我收到以下错误:
docker-compose build --pull
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Building nextcloud
Sending build context to Docker daemon 45.65GB
Step 1/3 : FROM nextcloud:apache
apache: Pulling from library/nextcloud
Digest: sha256:99d94124b2024c9f7f38dc12144a92bc0d68d110bcfd374169ebb7e8df0adf8e
Status: Image is up to date for nextcloud:apache
---> 0dd24a9c32e9
Step 2/3 : COPY setssl.sh /usr/local/bin/
---> Using cache
---> 360b5260b30a
Step 3/3 : RUN /usr/local/bin/setssl.sh mail@mail.com 172.30.0.2
---> Running in 4e77f23a45f2
touch: setting times of '/var/lib/apache2/module/enabled_by_admin/socache_shmcb': Operation not permitted
ERROR: Failed to create marker '/var/lib/apache2/module/enabled_by_admin/socache_shmcb'!
ERROR: Could not enable dependency socache_shmcb for ssl, aborting
touch: setting times of '/var/lib/apache2/site/enabled_by_admin/default-ssl': Operation not permitted
ERROR: Failed to create marker '/var/lib/apache2/site/enabled_by_admin/default-ssl'!
touch: setting times of '/var/lib/apache2/conf/enabled_by_admin/ssl-params': Operation not permitted
ERROR: Failed to create marker '/var/lib/apache2/conf/enabled_by_admin/ssl-params'!
The command '/bin/sh -c /usr/local/bin/setssl.sh mail@mail.com 172.30.0.2' returned a non-zero code: 1
ERROR: Service 'nextcloud' failed to build
我也尝试将它作为 sudo 运行(通常作为 pi 运行),但它并没有解决问题。不知道在这里做什么。 nextcloud 论坛不太主动寻求帮助..
【问题讨论】: