Nextcloud in docker: port not working

This is my docker-compose.yml to create nextcloud, a proxy, database and lets encrypt:

version: '3'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - /srv/docker-persist/MariaDB/nextcloud-sql:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=NCPWROOT
      - MYSQL_PASSWORD=NCPW
      - MYSQL_DATABASE=NCDATABASE
      - MYSQL_USER=NCUSER
    restart: unless-stopped

  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - /mnt/NC:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=sub.domain.tld
      - LETSENCRYPT_HOST=sub.domain.tld
      - LETSENCRYPT_EMAIL=e@mail.tld
    restart: unless-stopped

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

But i can’t reach the nextcloud interface with sub.domain.tld or even localhost (http and https).
I checked the listened ports:

[user@nuc nextcloud]$ sudo lsof -i -P -n | grep LISTEN
sshd         379  root    3u  IPv4  16054      0t0  TCP *:21(LISTEN)
sshd         379  root    4u  IPv6  16056      0t0  TCP *:21(LISTEN)

So there is no port 80 or 443. I used this docker-compose nearly a year ago and it works. Maybe something changed.

docker ps -a shows me port 80 on container nextcloud-app:

[user@nuc nextcloud]$ sudo docker ps -a
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                          PORTS                    NAMES
83878373043f   nextcloud:latest                         "/entrypoint.sh apac…"   11 minutes ago   Up 11 minutes                   80/tcp                   nextcloud-app
c1746f7274d2   jrcs/letsencrypt-nginx-proxy-companion   "/bin/bash /app/entr…"   11 minutes ago   Up 11 minutes                                            nextcloud-letsencrypt
8228c7a83ef5   jwilder/nginx-proxy:alpine               "/app/docker-entrypo…"   11 minutes ago   Restarting (0) 31 seconds ago                            nextcloud-proxy
cf7d190d04b0   mariadb                                  "docker-entrypoint.s…"   11 minutes ago   Up 11 minutes                   3306/tcp                 nextcloud-mariadb

grafik

your letsencrypt proxy isn’t starting.

so next step would be: sudo docker logs nextcloud-proxy

Oh, didn’t saw that. nextcloud-proxy log is not that helpful:

nginx.1    | 2021/01/03 16:17:30 [emerg] 29#29: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
nginx.1    | nginx: [emerg] invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:18:31 [emerg] 32#32: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:19:32 [emerg] 28#28: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:20:33 [emerg] 28#28: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:21:34 [emerg] 30#30: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
nginx.1    | nginx: [emerg] invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:22:35 [emerg] 32#32: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:23:37 [emerg] 29#29: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to dockergen.1
forego     | sending SIGTERM to nginx.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:24:38 [emerg] 32#32: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
nginx.1    | nginx: [emerg] invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1
forego     | starting dockergen.1 on port 5000
forego     | starting nginx.1 on port 5100
nginx.1    | 2021/01/03 16:25:39 [emerg] 33#33: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
nginx.1    | nginx: [emerg] invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:67
forego     | starting nginx.1 on port 5200
forego     | sending SIGTERM to nginx.1
forego     | sending SIGTERM to dockergen.1

look into ./proxy/conf.d/default.conf line 67.

upstream {
## Can be connected with “nextcloud_nextcloud_network” network
# nextcloud-app
server 172.19.0.5:80;
}

cant tell if upstream{} should look like this. But this is not from my ip range (192.168.178.XXX).

this (172.x.x.x) is the default network range of your internal docker network. (normally. and i assume you didn’t change it.)

so that should be ok.

you can check with either ip a s to see the networks on your host or sudo docker inspect nextcloud-app | more to check the internal ip address of the nextcloud container.


looking at the nginx manual I think the upstream name is missing:

grafik
https://nginx.org/en/docs/http/ngx_http_upstream_module.html

i’m wondering why it’s missing. because it should be automatically assigned/generated to the container that is proxied.

ip a s looks ok to me

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether f4:4d:30:69:9e:d7 brd ff:ff:ff:ff:ff:ff
        inet 192.168.178.28/24 brd 192.168.178.255 scope global dynamic noprefixroute enp1s0
           valid_lft 861548sec preferred_lft 861548sec
        inet6 fd00::af88:3f72:93ad:92b/64 scope global dynamic noprefixroute
           valid_lft 7037sec preferred_lft 3437sec
        inet6 fe80::902:bc8d:5b8c:90c7/64 scope link noprefixroute
           valid_lft forever preferred_lft forever
    3: br-db7a93b2c855: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
        link/ether 02:42:51:a9:8e:9b brd ff:ff:ff:ff:ff:ff
        inet 172.19.0.1/16 brd 172.19.255.255 scope global br-db7a93b2c855
           valid_lft forever preferred_lft forever
        inet6 fe80::42:51ff:fea9:8e9b/64 scope link
           valid_lft forever preferred_lft forever
    4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
        link/ether 02:42:4a:a9:42:e6 brd ff:ff:ff:ff:ff:ff
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
    5: br-a79872e7546e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
        link/ether 02:42:55:43:0c:32 brd ff:ff:ff:ff:ff:ff
        inet 172.18.0.1/16 brd 172.18.255.255 scope global br-a79872e7546e
           valid_lft forever preferred_lft forever
        inet6 fe80::42:55ff:fe43:c32/64 scope link
           valid_lft forever preferred_lft forever
    133: veth170a32e@if132: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-db7a93b2c855 state UP group default
        link/ether f6:e8:ae:7f:f2:fb brd ff:ff:ff:ff:ff:ff link-netnsid 1
        inet6 fe80::f4e8:aeff:fe7f:f2fb/64 scope link
           valid_lft forever preferred_lft forever
    135: veth210fcd4@if134: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-a79872e7546e state UP group default
        link/ether fa:13:77:20:3c:41 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        inet6 fe80::f813:77ff:fe20:3c41/64 scope link
           valid_lft forever preferred_lft forever
    137: veth4aab149@if136: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-db7a93b2c855 state UP group default
        link/ether 7e:18:33:3b:ef:70 brd ff:ff:ff:ff:ff:ff link-netnsid 2
        inet6 fe80::7c18:33ff:fe3b:ef70/64 scope link
           valid_lft forever preferred_lft forever
    139: vethfde457b@if138: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-db7a93b2c855 state UP group default
        link/ether 26:f6:cb:7e:42:52 brd ff:ff:ff:ff:ff:ff link-netnsid 4
        inet6 fe80::24f6:cbff:fe7e:4252/64 scope link
           valid_lft forever preferred_lft forever

sudo docker inspect nextcloud-app | more:

    [
        {
            "Id": "83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525",
            "Created": "2021-01-03T10:34:27.312093707Z",
            "Path": "/entrypoint.sh",
            "Args": [
                "apache2-foreground"
            ],
            "State": {
                "Status": "running",
                "Running": true,
                "Paused": false,
                "Restarting": false,
                "OOMKilled": false,
                "Dead": false,
                "Pid": 17324,
                "ExitCode": 0,
                "Error": "",
                "StartedAt": "2021-01-03T16:34:16.388008393Z",
                "FinishedAt": "2021-01-03T16:34:03.070365902Z"
            },
            "Image": "sha256:110958e8c3941166365fdbfbed2046f92f202ab93bd399f2f7f121252ba89cb9",
            "ResolvConfPath": "/var/lib/docker/containers/83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525/resolv.conf",
            "HostnamePath": "/var/lib/docker/containers/83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525/hostname",
            "HostsPath": "/var/lib/docker/containers/83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525/hosts",
            "LogPath": "/var/lib/docker/containers/83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525/83878373043f62f4264443676336d3c61d7dcda628fe935a4d10bbfc84bef525-json.log",
            "Name": "/nextcloud-app",
            "RestartCount": 0,
            "Driver": "overlay2",
            "Platform": "linux",
            "MountLabel": "",
            "ProcessLabel": "",
            "AppArmorProfile": "docker-default",
            "ExecIDs": null,
            "HostConfig": {
                "Binds": [
                    "/etc/localtime:/etc/localtime:ro",
                    "/mnt/NC:/var/www/html/data:rw",
                    "/home/user/docker-compose-files/nextcloud/app/config:/var/www/html/config:rw",
                    "/home/user/docker-compose-files/nextcloud/app/themes:/var/www/html/themes:rw",
                    "/home/user/docker-compose-files/nextcloud/app/custom_apps:/var/www/html/custom_apps:rw",
                    "nextcloud_nextcloud:/var/www/html:rw"
                ],
                "ContainerIDFile": "",
                "LogConfig": {
                    "Type": "json-file",
                    "Config": {}
                },
                "NetworkMode": "nextcloud_nextcloud_network",
                "PortBindings": {},
                "RestartPolicy": {
                    "Name": "unless-stopped",
                    "MaximumRetryCount": 0
                },
                "AutoRemove": false,
                "VolumeDriver": "",
                "VolumesFrom": [],
                "CapAdd": null,
                "CapDrop": null,
                "CgroupnsMode": "host",
                "Dns": [],
                "DnsOptions": [],
                "DnsSearch": [],
                "ExtraHosts": null,
                "GroupAdd": null,
                "IpcMode": "private",
                "Cgroup": "",
                "Links": null,
                "OomScoreAdj": 0,
                "PidMode": "",
                "Privileged": false,
                "PublishAllPorts": false,
                "ReadonlyRootfs": false,
                "SecurityOpt": null,
                "UTSMode": "",
                "UsernsMode": "",
                "ShmSize": 67108864,
                "Runtime": "runc",
                "ConsoleSize": [
                    0,
                    0
                ],
                "Isolation": "",
                "CpuShares": 0,
                "Memory": 0,
                "NanoCpus": 0,
                "CgroupParent": "",
                "BlkioWeight": 0,
                "BlkioWeightDevice": null,
                "BlkioDeviceReadBps": null,
                "BlkioDeviceWriteBps": null,
                "BlkioDeviceReadIOps": null,
                "BlkioDeviceWriteIOps": null,
                "CpuPeriod": 0,
                "CpuQuota": 0,
                "CpuRealtimePeriod": 0,
                "CpuRealtimeRuntime": 0,
                "CpusetCpus": "",
                "CpusetMems": "",
                "Devices": null,
                "DeviceCgroupRules": null,
                "DeviceRequests": null,
                "KernelMemory": 0,
                "KernelMemoryTCP": 0,
                "MemoryReservation": 0,
                "MemorySwap": 0,
                "MemorySwappiness": null,
                "OomKillDisable": false,
                "PidsLimit": null,
                "Ulimits": null,
                "CpuCount": 0,
                "CpuPercent": 0,
                "IOMaximumIOps": 0,
                "IOMaximumBandwidth": 0,
                "MaskedPaths": [
                    "/proc/asound",
                    "/proc/acpi",
                    "/proc/kcore",
                    "/proc/keys",
                    "/proc/latency_stats",
                    "/proc/timer_list",
                    "/proc/timer_stats",
                    "/proc/sched_debug",
                    "/proc/scsi",
                    "/sys/firmware"
                ],
                "ReadonlyPaths": [
                    "/proc/bus",
                    "/proc/fs",
                    "/proc/irq",
                    "/proc/sys",
                    "/proc/sysrq-trigger"
                ]
            },
            "GraphDriver": {
                "Data": {
                    "LowerDir": "/var/lib/docker/overlay2/3b7a03458b223dadba4c282342b3b2b61929243d68b1be0769f49191dfea8c29-init/diff:/var/lib/docker/overlay2/35a015c027e0b804f31e0b6696513ae785380a702cf8b084eedd5528c0db7cd9/diff:/var/lib/docker/overlay2/5f33dc872a54194f9d66ff41c40e174ce11fce81897515e0ca9c23a26ab4547b/diff:/var/lib/docker/overlay2/3a367494c2a85c26ec0327b83c0b528215dbccd33a7c35dd4de9098e1fafbcb6/diff:/var/lib/docker/overlay2/df4eb8e5938f4e171ea9f0160825863543849cc569f0fbf153f07608ecec9ab7/diff:/var/lib/docker/overlay2/ba74b20f70c31aa63de1e51f284f17b5aff4f4eb7258e7010ab504cfc97e4626/diff:/var/lib/docker/overlay2/c2a5bedb933e43ffcff2a4c9e78d6a65f1a8d7a73c4832f27bf2f9d1a8fbe068/diff:/var/lib/docker/overlay2/5b3d85dc861c2b06dedb7b7153fd678b9e9e02151bfa123201a47540a3fcb69f/diff:/var/lib/docker/overlay2/85c2748fe5c0e05a333b39d1b0a14be90390458f21b7a5d4634b3f063c23dfce/diff:/var/lib/docker/overlay2/717b590ec341cca6afa5cf849d5a3b7f59894729873be60804875bac177ba8de/diff:/var/lib/docker/overlay2/dfb2f5dbd7e13dbe4e7f9c1a63105373a6d8d3d93e458f788386a93e796a7720/diff:/var/lib/docker/overlay2/cc0536a00077227b8467cd32299a2cf177e2f587c7d3947ab5f71fa5ca76c041/diff:/var/lib/docker/overlay2/473b902bc9613a46050c67acb02dfa92cb1f69b9b9c6c5272212ac1b2f351232/diff:/var/lib/docker/overlay2/da4c3767317f3c27b7e96690afd83c1b050ee5ba38ea68014458280b42f0d84c/diff:/var/lib/docker/overlay2/46073957be7d6635854fd2c9564a76d83980c724d325916fd1f4b09fc133be43/diff:/var/lib/docker/overlay2/2b4b55d37ed11f13ec8eed74216c4d5d9a27a9c770a1194187a623390be7a6e2/diff:/var/lib/docker/overlay2/6c4dc576b8ed43bdcdcae0a92c04bbb1eabe3a1eaf1b1ebbdec7ff94908baef6/diff:/var/lib/docker/overlay2/37748c6cb7788227874853cf631ff3ed00d33f95289a765b3261125f39cb3c06/diff:/var/lib/docker/overlay2/9c8cf913b83a210a9048858481104666083ca1d91cbd7076d9f68486305e8c69/diff:/var/lib/docker/overlay2/d1e970533eaa0ece9c5d1c70b080cb2a6397e5059777975c0b90e4c0608ef07d/diff:/var/lib/docker/overlay2/8be62c114f14d40c38afc56ec97691f41520159f5b5816e5b0e5dfd242505285/diff",
                    "MergedDir": "/var/lib/docker/overlay2/3b7a03458b223dadba4c282342b3b2b61929243d68b1be0769f49191dfea8c29/merged",
                    "UpperDir": "/var/lib/docker/overlay2/3b7a03458b223dadba4c282342b3b2b61929243d68b1be0769f49191dfea8c29/diff",
                    "WorkDir": "/var/lib/docker/overlay2/3b7a03458b223dadba4c282342b3b2b61929243d68b1be0769f49191dfea8c29/work"
                },
                "Name": "overlay2"
            },
            "Mounts": [
                {
                    "Type": "bind",
                    "Source": "/home/user/docker-compose-files/nextcloud/app/themes",
                    "Destination": "/var/www/html/themes",
                    "Mode": "rw",
                    "RW": true,
                    "Propagation": "rprivate"
                },
                {
                    "Type": "bind",
                    "Source": "/etc/localtime",
                    "Destination": "/etc/localtime",
                    "Mode": "ro",
                    "RW": false,
                    "Propagation": "rprivate"
                },
                {
                    "Type": "volume",
                    "Name": "nextcloud_nextcloud",
                    "Source": "/var/lib/docker/volumes/nextcloud_nextcloud/_data",
                    "Destination": "/var/www/html",
                    "Driver": "local",
                    "Mode": "rw",
                    "RW": true,
                    "Propagation": ""
                },
                {
                    "Type": "bind",
                    "Source": "/home/user/docker-compose-files/nextcloud/app/config",
                    "Destination": "/var/www/html/config",
                    "Mode": "rw",
                    "RW": true,
                    "Propagation": "rprivate"
                },
                {
                    "Type": "bind",
                    "Source": "/home/user/docker-compose-files/nextcloud/app/custom_apps",
                    "Destination": "/var/www/html/custom_apps",
                    "Mode": "rw",
                    "RW": true,
                    "Propagation": "rprivate"
                },
                {
                    "Type": "bind",
                    "Source": "/mnt/NC",
                    "Destination": "/var/www/html/data",
                    "Mode": "rw",
                    "RW": true,
                    "Propagation": "rprivate"
                }
            ],
            "Config": {
                "Hostname": "83878373043f",
                "Domainname": "",
                "User": "",
                "AttachStdin": false,
                "AttachStdout": false,
                "AttachStderr": false,
                "ExposedPorts": {
                    "80/tcp": {}
                },
                "Tty": false,
                "OpenStdin": false,
                "StdinOnce": false,
                "Env": [
                    "VIRTUAL_HOST=sub.domain.tld",
                    "LETSENCRYPT_HOST=sub.domain.tld",
                    "LETSENCRYPT_EMAIL=e@mail.tld",
                    "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                    "PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
                    "PHP_INI_DIR=/usr/local/etc/php",
                    "APACHE_CONFDIR=/etc/apache2",
                    "APACHE_ENVVARS=/etc/apache2/envvars",
                    "PHP_EXTRA_BUILD_DEPS=apache2-dev",
                    "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2 --disable-cgi",
                    "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
                    "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
                    "PHP_LDFLAGS=-Wl,-O1 -pie",
                    "GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312",
                    "PHP_VERSION=7.4.13",
                    "PHP_URL=https://www.php.net/distributions/php-7.4.13.tar.xz",
                    "PHP_ASC_URL=https://www.php.net/distributions/php-7.4.13.tar.xz.asc",
                    "PHP_SHA256=aead303e3abac23106529560547baebbedba0bb2943b91d5aa08fff1f41680f4",
                    "NEXTCLOUD_VERSION=20.0.4"
                ],
                "Cmd": [
                    "apache2-foreground"
                ],
                "Image": "nextcloud:latest",
                "Volumes": {
                    "/etc/localtime": {},
                    "/var/www/html": {},
                    "/var/www/html/config": {},
                    "/var/www/html/custom_apps": {},
                    "/var/www/html/data": {},
                    "/var/www/html/themes": {}
                },
                "WorkingDir": "/var/www/html",
                "Entrypoint": [
                    "/entrypoint.sh"
                ],
                "OnBuild": null,
                "Labels": {
                    "com.docker.compose.config-hash": "4335a44c9b234cf6f00b55cda86b6e2150c788f04139b11a5d49a95e3c0d096e",
                    "com.docker.compose.container-number": "1",
                    "com.docker.compose.oneoff": "False",
                    "com.docker.compose.project": "nextcloud",
                    "com.docker.compose.project.config_files": "docker-compose.yml",
                    "com.docker.compose.project.working_dir": "/home/user/docker-compose-files/nextcloud",
                    "com.docker.compose.service": "app",
                    "com.docker.compose.version": "1.27.4"
                },
                "StopSignal": "SIGWINCH"
            },
            "NetworkSettings": {
                "Bridge": "",
                "SandboxID": "5e086bbf58a5a02ad44f0507c06d3ffa9194f2deaba1f5310d89e371aaa49c33",
                "HairpinMode": false,
                "LinkLocalIPv6Address": "",
                "LinkLocalIPv6PrefixLen": 0,
                "Ports": {
                    "80/tcp": null
                },
                "SandboxKey": "/var/run/docker/netns/5e086bbf58a5",
                "SecondaryIPAddresses": null,
                "SecondaryIPv6Addresses": null,
                "EndpointID": "",
                "Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "MacAddress": "",
                "Networks": {
                    "nextcloud_nextcloud_network": {
                        "IPAMConfig": null,
                        "Links": null,
                        "Aliases": [
                            "app",
                            "83878373043f"
                        ],
                        "NetworkID": "db7a93b2c8553234a69f664d2693b51e4c5d80483d01b84abaf0c9db8e70c17d",
                        "EndpointID": "297ea19e0ca34d17f6dd22fb2f02e92665f0714f9963525e029d2ce41a0c9691",
                        "Gateway": "172.19.0.1",
                        "IPAddress": "172.19.0.2",
                        "IPPrefixLen": 16,
                        "IPv6Gateway": "",
                        "GlobalIPv6Address": "",
                        "GlobalIPv6PrefixLen": 0,
                        "MacAddress": "02:42:ac:13:00:02",
                        "DriverOpts": null
                    }
                }
            }
        }
    ]

I think something is wrong in my docker-compose …? I set it up like this a year ago and it works fine.

Edit: i deleted all container and folder/files and run docker-compose again. Now, i dont know why, i can reach a nextcloud web interface with https://sub.domain.tld with this message:

The server could not complete the request.

If this occurs again, please send the following technical details to your server administrator.

Further details can be found in the server log.

### Technical details

* Remote address: XX.XX.XX.XX
* Inquiry ID: XXXXXXXXXX

But still, docker ps -a only shows port 80, not 443.
But again:

docker-pr 21461  root    4u  IPv6 110149      0t0  TCP *:443 (LISTEN)
docker-pr 21474  root    4u  IPv6 108179      0t0  TCP *:80 (LISTEN)

My nextcloud logfile should be in /mnt/NC:/var/www/html/data which means /mnt/NC/nextcloud.log but there is nothing.

i just copy&paste your docker-compose file, change the fqdn of the server and le-email and get a running nextcloud stack.

so. no your docker-compose is ok.

looking at my proxy/conf.d/default.conf.

# my-domain.com
upstream my-domain.com {
                                ## Can be connected with "docker-test_nextcloud_network" network
                        # nextcloud-app
                        server 172.21.0.5:80;
}
server {
        server_name my-domain.com;
        listen 80 ;
        access_log /var/log/nginx/access.log vhost;
        # Do not HTTPS redirect Let'sEncrypt ACME challenge
        location /.well-known/acme-challenge/ {
                auth_basic off;
                allow all;
                root /usr/share/nginx/html;
                try_files $uri =404;
                break;
        }
        location / {
                return 301 https://$host$request_uri;
        }
}
server {
        server_name my-domain.com;
        listen 443 ssl http2 ;
        access_log /var/log/nginx/access.log vhost;
        ssl_session_timeout 5m;
        ssl_session_cache shared:SSL:50m;
        ssl_session_tickets off;
...
        include /etc/nginx/vhost.d/default;
        location / {
                proxy_pass http://my-domain.com;
        }

as you can see, in my proxy/conf.d/default.conf the “upstream” statement is followed by the fqdn of the server.

and this is done automatically by a script in the proxy image.

so we have to look a the difference between your setup and mine. ok?

when you “reset” everything, did you remove the folder proxy/ as well?

the nextcloud.log:

{"reqId":"DOspORxW6rErSOnopix7","level":3,"time":"2021-01-03T16:58:35+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"touch(): Unable to create file /var/www/html/config/config.php because Permission denied at /var/www/html/lib/private/Config.php#242","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"touch(): Unable to create file /var/www/html/config/config.php because Permission denied","/var/www/html/lib/private/Config.php",242,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocf72lfkiqrb',\n);\n"}]},{"file":"/var/www/html/lib/private/Config.php","line":242,"function":"touch","args":["/var/www/html/config/config.php"]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"DOspORxW6rErSOnopix7","level":3,"time":"2021-01-03T16:58:35+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"fopen(/var/www/html/config/config.php): failed to open stream: No such file or directory at /var/www/html/lib/private/Config.php#243","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"fopen(/var/www/html/config/config.php): failed to open stream: No such file or directory","/var/www/html/lib/private/Config.php",243,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocf72lfkiqrb',\n);\n"}]},{"file":"/var/www/html/lib/private/Config.php","line":243,"function":"fopen","args":["/var/www/html/config/config.php","r+"]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"DOspORxW6rErSOnopix7","level":3,"time":"2021-01-03T16:58:35+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"chmod(): No such file or directory at /var/www/html/lib/private/Config.php#246","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"chmod(): No such file or directory","/var/www/html/lib/private/Config.php",246,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocf72lfkiqrb',\n);\n","filePointer":false}]},{"file":"/var/www/html/lib/private/Config.php","line":246,"function":"chmod","args":["/var/www/html/config/config.php",416]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"DOspORxW6rErSOnopix7","level":3,"time":"2021-01-03T16:58:35+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"OC\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocf72lfkiqrb"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Config.php","Line":250,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"DOspORxW6rErSOnopix7","level":3,"time":"2021-01-03T16:58:35+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"Doctrine\\DBAL\\Exception\\TableNotFoundException","Message":"An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":169,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver","type":"->","args":["An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig",{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":149,"function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver"},{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig"]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":914,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver"},{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"SELECT * FROM \"oc_appconfig\"",[]]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php","Line":43,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDOException","Message":"SQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":911,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDOConnection","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","Line":83,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","line":78,"function":"query","class":"PDO","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":911,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDOConnection","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","Line":78}},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"e5XZR7WTpdcLVKnUADLm","level":3,"time":"2021-01-03T17:11:47+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"touch(): Unable to create file /var/www/html/config/config.php because Permission denied at /var/www/html/lib/private/Config.php#242","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"touch(): Unable to create file /var/www/html/config/config.php because Permission denied","/var/www/html/lib/private/Config.php",242,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'oc02xysa8n5l',\n);\n"}]},{"file":"/var/www/html/lib/private/Config.php","line":242,"function":"touch","args":["/var/www/html/config/config.php"]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"e5XZR7WTpdcLVKnUADLm","level":3,"time":"2021-01-03T17:11:47+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"fopen(/var/www/html/config/config.php): failed to open stream: No such file or directory at /var/www/html/lib/private/Config.php#243","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"fopen(/var/www/html/config/config.php): failed to open stream: No such file or directory","/var/www/html/lib/private/Config.php",243,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'oc02xysa8n5l',\n);\n"}]},{"file":"/var/www/html/lib/private/Config.php","line":243,"function":"fopen","args":["/var/www/html/config/config.php","r+"]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"e5XZR7WTpdcLVKnUADLm","level":3,"time":"2021-01-03T17:11:47+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"chmod(): No such file or directory at /var/www/html/lib/private/Config.php#246","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"chmod(): No such file or directory","/var/www/html/lib/private/Config.php",246,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'oc02xysa8n5l',\n);\n","filePointer":false}]},{"file":"/var/www/html/lib/private/Config.php","line":246,"function":"chmod","args":["/var/www/html/config/config.php",416]},{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"e5XZR7WTpdcLVKnUADLm","level":3,"time":"2021-01-03T17:11:47+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"OC\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/var/www/html/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","oc02xysa8n5l"]},{"file":"/var/www/html/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Config.php","Line":250,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
{"reqId":"e5XZR7WTpdcLVKnUADLm","level":3,"time":"2021-01-03T17:11:47+00:00","remoteAddr":"XX.XX.XX.XXX","user":"--","app":"index","method":"GET","url":"/","message":{"Exception":"Doctrine\\DBAL\\Exception\\TableNotFoundException","Message":"An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":169,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver","type":"->","args":["An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig",{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":149,"function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver"},{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"An exception occurred while executing 'SELECT * FROM \"oc_appconfig\"':\n\nSQLSTATE[HY000]: General error: 1 no such table: oc_appconfig"]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":914,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver"},{"errorInfo":["HY000",1,"no such table: oc_appconfig"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"SELECT * FROM \"oc_appconfig\"",[]]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php","Line":43,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDOException","Message":"SQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":911,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDOConnection","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","Line":83,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1 no such table: oc_appconfig","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","line":78,"function":"query","class":"PDO","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":911,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDOConnection","type":"->","args":["SELECT * FROM \"oc_appconfig\""]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":202,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":206,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM \"oc_appconfig\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":217,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"enabled"]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\App\\AppManager","type":"->","args":["theming"]},{"file":"/var/www/html/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.",503]}],"File":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php","Line":78}},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","version":""}
"Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory.

So… whats next?

[nuc app]# ls -l
insgesamt 12
drwxr-xr-x 2 root root 4096  3. Jan 17:40 config

I tried changing the owner of config to www-data but no success:

[nuc app]# chown www-data:www-data config/
[nuc app]# ls -l
insgesamt 12
drwxr-xr-x 2 www-data www-data 4096  3. Jan 17:40 config

Whats important: On my host system, gid/uid 33 belongt to http, www-data (self created) has 1004:1002:

http:x:33:33::/srv/http:/usr/bin/nologin
www-data:x:1004:1002::/home/www-data:/bin/bash

so even tried to change the owner to http. Still the same message.

Sorry, didnt saw you’re post! Maybe look at my newest one.

What i did:

    sudo docker stop nextcloud-app nextcloud-letsencrypt nextcloud-mariadb nextcloud-proxy
    sudo docker rm nextcloud-app nextcloud-letsencrypt nextcloud-mariadb nextcloud-proxy
    rm -r ./app ./proxy

(folder “app” belongt to nextcloud-app, folder “proxy” belongt to nextcloud-proxy). The run again docker-compose. Like i said, i can now reach a web interface. My upstream looks also ok to me:

# sub.domain.tld
upstream sub.domain.tld {
                                ## Can be connected with "nextcloud_nextcloud_network" network
                        # nextcloud-app
                        server 172.19.0.3:80;
}

but have other issues with permissions.

Thank you so far!

btw Ownership in container (didnt changed anything!):

[nuc conf.d]# sudo docker exec -it nextcloud-app /bin/bash
root@ee0e6c87aee6:/var/www/html# ls
3rdparty  COPYING  config       core      custom_apps  index.html  lib  ocm-provider  ocs-provider  remote.php  robots.txt  themes
AUTHORS   apps     console.php  cron.php  data         index.php   occ  ocs           public.php    resources   status.php  version.php
root@ee0e6c87aee6:/var/www/html# ls -l
total 156
drwxr-xr-x 41 www-data root      4096 Jan  3 09:23 3rdparty
-rw-r--r--  1 www-data root     17234 Jan  3 09:23 AUTHORS
-rw-r--r--  1 www-data root     34520 Jan  3 09:23 COPYING
drwxr-xr-x 47 www-data root      4096 Jan  3 09:23 apps
drwxr-xr-x  2     1004     1002  4096 Jan  3 17:40 config
-rw-r--r--  1 www-data root      3893 Jan  3 09:23 console.php
drwxr-xr-x 22 www-data root      4096 Jan  3 09:23 core
-rw-r--r--  1 www-data root      5083 Jan  3 09:23 cron.php
drwxr-xr-x  2     1004     1002  4096 Jan  3 17:40 custom_apps
drwxrwx---  1 www-data www-data  8192 Jan  3 18:29 data
-rw-r--r--  1 www-data root       156 Jan  3 09:23 index.html
-rw-r--r--  1 www-data root      2960 Jan  3 09:23 index.php
drwxr-xr-x  6 www-data root      4096 Jan  3 09:23 lib
-rwxr-xr-x  1 www-data root       283 Jan  3 09:23 occ
drwxr-xr-x  2 www-data root      4096 Jan  3 09:23 ocm-provider
drwxr-xr-x  2 www-data root      4096 Jan  3 09:23 ocs
drwxr-xr-x  2 www-data root      4096 Jan  3 09:23 ocs-provider
-rw-r--r--  1 www-data root      3102 Jan  3 09:23 public.php
-rw-r--r--  1 www-data root      5332 Jan  3 09:23 remote.php
drwxr-xr-x  4 www-data root      4096 Jan  3 09:23 resources
-rw-r--r--  1 www-data root        26 Jan  3 09:23 robots.txt
-rw-r--r--  1 www-data root      2379 Jan  3 09:23 status.php
drwxr-xr-x  2     1004     1002  4096 Jan  3 17:40 themes
-rw-r--r--  1 www-data root       382 Jan  3 09:23 version.php

(1004 and 1002 seems to be related to my self created www-data on my host, i don’t know why its there)

So i changed the ownership of config, custom_apps and themes directory to www-data:www-data, now i get in browser:

It looks like you want to install Nextcloud again. However, the CAN_INSTALL file is missing from your configuration folder. Please create the CAN_INSTALL file in the configuration folder to continue.

Sorry for so much posts but i get it work. I created an empty CAN_INSTALL inside the config folder, after that i could start the installation. That was hard. Thanks again for your help!

docker-compose down should do the trick.

this belongs to “don’t to this” in the docker world. trying to keep the user id on the host and in the container in sync. because it leads to this: