Nextcloud database container won't start

Nextcloud aio failed to start.

Here’s the database container log:

Setting postgres values...
chmod: /var/run/postgresql: Operation not permitted

PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-05-17 09:49:58.551 AEST [14] LOG:  starting PostgreSQL 15.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
2024-05-17 09:49:58.551 AEST [14] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-05-17 09:49:58.551 AEST [14] LOG:  listening on IPv6 address "::", port 5432
2024-05-17 09:49:58.592 AEST [14] FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
2024-05-17 09:49:58.619 AEST [14] LOG:  database system is shut down
Setting postgres values...
chmod: /var/run/postgresql: Operation not permitted

PostgreSQL Database directory appears to contain a database; Skipping initialization

Hi, are these the complete logs? Also, why do you think that the container is not starting correctly?

Pretty much, it just keeps repeating the same error message.

The last part of the log:

2024-05-17 18:39:26.679 AEST [14] LOG:  starting PostgreSQL 15.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
2024-05-17 18:39:26.679 AEST [14] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-05-17 18:39:26.679 AEST [14] LOG:  listening on IPv6 address "::", port 5432
2024-05-17 18:39:26.767 AEST [14] FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
2024-05-17 18:39:26.799 AEST [14] LOG:  database system is shut down

Within the “Container Station”, the “nextcloud-aio-database” container status is: Others, I thought it should be either Running or “Stopped”.

Can you post the output of sudo docker inspect nextcloud-aio-database here?

Err, I am really new to this, and don’t have an IT background… Not sure how to get the output.

I am guessing I need SSH to QNAP using the command line? So I turned on SSH option, but when I tried to connect,

ssh admin@***.***.*.***

it gives me a “ssh: connect to host *** port 22: Connection timed out” error.

Not sure if it’s the same thing…

The Container station has a built-in inspection tool, which might provide some helpful information?

{
AppArmorProfile:"docker-default"
Args:[]
Config:{
AttachStderr:false
AttachStdin:false
AttachStdout:false
Domainname:""
Entrypoint:[
"/start.sh"
]
Env:[
"POSTGRES_PASSWORD=****"
"POSTGRES_DB=nextcloud_database"
"POSTGRES_USER=nextcloud"
"TZ=Australia/Sydney"
"PGTZ=Australia/Sydney"
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
"LANG=en_US.utf8"
"PG_MAJOR=15"
"PG_VERSION=15.6"
"PG_SHA256=8455146ed9c69c93a57de954aead0302cafad035c2b242175d***"
"DOCKER_PG_LLVM_DEPS=llvm15-dev clang15"
"PGDATA=/var/lib/postgresql/data"
]
ExposedPorts:{
5432/tcp:{}
}
Healthcheck:{
Test:[
"CMD-SHELL"
"/healthcheck.sh"
]
}
Hostname:"0fb8b9544931"
Image:"nextcloud/aio-postgresql:latest"
Labels:{
com.centurylinklabs.watchtower.enable:"false"
}
OpenStdin:false
StdinOnce:false
StopSignal:"SIGINT"
Tty:false
User:"postgres"
Volumes:{
/mnt/data:{}
/var/lib/postgresql/data:{}
}
WorkingDir:""
}
Created:"2024-05-17T09:07:28.64897034Z"
Driver:"overlay2"
GraphDriver:{}
HostConfig:{}
HostnamePath:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/hostname"
HostsPath:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/hosts"
Id:"0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810"
Image:"sha256:1f652299e223b73c0869a777f86d9a80a040bd3d34f5b03fe696807e883e3dbe"
LogPath:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810-json.log"
MountLabel:""
Mounts:[
{
Destination:"/var/lib/postgresql/data"
Driver:"local"
Mode:"rw"
Name:"nextcloud_aio_database"
Propagation:""
RW:true
Source:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/nextcloud_aio_database/_data"
Type:"volume"
}
{
Destination:"/mnt/data"
Driver:"local"
Mode:"rw"
Name:"nextcloud_aio_database_dump"
Propagation:""
RW:true
Source:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/nextcloud_aio_database_dump/_data"
Type:"volume"
}
]
Name:"/nextcloud-aio-database"
NetworkSettings:{
Bridge:""
EndpointID:""
Gateway:""
GlobalIPv6Address:""
GlobalIPv6PrefixLen:0
HairpinMode:false
IPAddress:""
IPPrefixLen:0
IPv6Gateway:""
LinkLocalIPv6Address:""
LinkLocalIPv6PrefixLen:0
MacAddress:""
Networks:{
nextcloud-aio:{
Aliases:[
"0fb8b9544931"
]
EndpointID:""
Gateway:""
GlobalIPv6Address:""
GlobalIPv6PrefixLen:0
IPAddress:""
IPPrefixLen:0
IPv6Gateway:""
MacAddress:""
NetworkID:"411da493bfd46833f84540bc40f4a5eb8aa52ad5c04d7e2acf6a1846d740a0dd"
}
}
Ports:{}
SandboxID:"27b512d34ccb8fb0692c4de20762bcadc33afb39544c46b63***8"
SandboxKey:"/var/run/docker/netns/27b512d34ccb"
}
Path:"/start.sh"
Platform:"linux"
ProcessLabel:""
ResolvConfPath:"/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/resolv.conf"
RestartCount:28
State:{
Dead:false
Error:""
ExitCode:1
FinishedAt:"2024-05-17T09:26:56.677720867Z"
Health:{
FailingStreak:0
Log:[]
Status:"unhealthy"
}
OOMKilled:false
Paused:false
Pid:0
Restarting:true
Running:true
StartedAt:"2024-05-17T09:26:56.3369318Z"
Status:"restarting"
}
}

Seems like this is your issue…

Which docker version is installed on your qnap?

Can you post the output of sudo docker info here?

Based on QNAP release notes:

“Updated Docker Engine to version 20.10.27 and Docker Compose to version 2.15.1.”

Container station version: 3.0.6.833

Thanks, I finally figured out how to ssh into QNAP; here’s the result of sudo docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., v2.15.1-qnap1)

Server:
 Containers: 14
  Running: 10
  Paused: 0
  Stopped: 4
 Images: 17
 Server Version: 20.10.27-qnap1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay qnet
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux kata-runtime nvidia-runtime runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe0
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.10.60-qnap
 Operating System: QTS 5.1.6 (20240402)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 62.77GiB
 Name: TS473A
 ID: H5FY:44YF:IVGX:ID66:TRP6:MAKY:2Q2I:ZEN7:TFXA:2GVI:BJ7R:DPG4
 Docker Root Dir: /share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker
 Debug Mode: true
  File Descriptors: 10651
  Goroutines: 140
  System Time: 2024-05-18T11:39:26.201989667+10:00
  EventsListeners: 1
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
 Default Address Pools:
   Base: 172.29.0.0/16, Size: 22

And the output of sudo docker inspect nextcloud-aio-database:

[
    {
        "Id": "0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810",
        "Created": "2024-05-17T09:07:28.64897034Z",
        "Path": "/start.sh",
        "Args": [],
        "State": {
            "Status": "restarting",
            "Running": true,
            "Paused": false,
            "Restarting": true,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            "StartedAt": "2024-05-18T01:41:07.870300124Z",
            "FinishedAt": "2024-05-18T01:41:08.310052839Z",
            "Health": {
                "Status": "unhealthy",
                "FailingStreak": 0,
                "Log": []
            }
        },
        "Image": "sha256:1f652299e223b73c0869a777f86d9a80a040bd3d34f5b03fe696807e883e3dbe",
        "ResolvConfPath": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/resolv.conf",
        "HostnamePath": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/hostname",
        "HostsPath": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/hosts",
        "LogPath": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810/0fb8b9544931997cffbbe0290c51535ab959d946f6f67aaed92cf8b2a7096810-json.log",
        "Name": "/nextcloud-aio-database",
        "RestartCount": 985,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "nextcloud_aio_database:/var/lib/postgresql/data:rw",
                "nextcloud_aio_database_dump:/mnt/data:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-file": "10",
                    "max-size": "10m"
                }
            },
            "NetworkMode": "nextcloud-aio",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": [
                "NET_RAW"
            ],
            "CgroupnsMode": "host",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": true,
            "SecurityOpt": [
                "label:disable"
            ],
            "Tmpfs": {
                "/var/run/postgresql": ""
            },
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 268435456,
            "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": [
                {
                    "Name": "nofile",
                    "Hard": 65535,
                    "Soft": 65535
                }
            ],
            "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",
                "/sys/devices/virtual/powercap"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ],
            "Init": true
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/892713b1479982d65d6c4dbbc33d09d59e2e959753da98cbe8312e9595205ba9-init/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/836be152fe05d01e108e2d9a638fcb79954718bf9bc03ba4b793ad751670257a/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/42d2748b41008630f43c78d2e80454b8dc58ba07214be09e9dfc832264393cf4/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/0ccd7811411cd2bc17de1455ad807cfe304816a420e49572d0c7a1e54af6c8fa/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/bb35f2e76308ebd68d6fa958299710c8eb9d4f5eff50fb50a66352f6e049fc0b/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/a676caac3a4fda0b28d8eb835185b218ade48ad736533e6cf4bd988b2d4d19e7/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/3890f9c02cb546cc795655064bc7b93ec41b74e20389b5e7aad29aa2f0ecbad7/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/66d0ba2989713b685ff4d6e23f702e0f4f70fec9e678cedb4b166c33e664817e/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/9d8493e3a7a16614ae40b122b967a9d10d72b1eb4aa0ef39b07b8312450b22ab/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/349910381c5a678cc56c90c2a09d0b1c43b5bace8a1e2c4fe331fbf894ebd196/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/e38eb25e629197a4bafed73e78d7464cfeb217503b99420f748a2019a3e0d883/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/5864465477f3d834fd5eebe438c50236427f95b277674efb7f729f55596dec16/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/d3994ae29aef3d2d96e91a6b97986f875c27fa11632bbeede8077f5c1229aca8/diff:/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/739fddeb38f81f8927035c8f18ff60353a34629b0166afa27ab2973b01107e15/diff",
                "MergedDir": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/892713b1479982d65d6c4dbbc33d09d59e2e959753da98cbe8312e9595205ba9/merged",
                "UpperDir": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/892713b1479982d65d6c4dbbc33d09d59e2e959753da98cbe8312e9595205ba9/diff",
                "WorkDir": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/892713b1479982d65d6c4dbbc33d09d59e2e959753da98cbe8312e9595205ba9/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "nextcloud_aio_database",
                "Source": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/nextcloud_aio_database/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "volume",
                "Name": "nextcloud_aio_database_dump",
                "Source": "/share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/nextcloud_aio_database_dump/_data",
                "Destination": "/mnt/data",
                "Driver": "local",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "0fb8b9544931",
            "Domainname": "",
            "User": "postgres",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "POSTGRES_PASSWORD=13a7b292f8d6e8369d48d412b1edd6f13dc49b10a0d3d4ff",
                "POSTGRES_DB=nextcloud_database",
                "POSTGRES_USER=nextcloud",
                "TZ=Australia/Sydney",
                "PGTZ=Australia/Sydney",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=en_US.utf8",
                "PG_MAJOR=15",
                "PG_VERSION=15.6",
                "PG_SHA256=8455146ed9c69c93a57de954aead0302cafad035c2b242175d6aa1e17ebcb2fb",
                "DOCKER_PG_LLVM_DEPS=llvm15-dev \t\tclang15",
                "PGDATA=/var/lib/postgresql/data"
            ],
            "Cmd": null,
            "Healthcheck": {
                "Test": [
                    "CMD-SHELL",
                    "/healthcheck.sh"
                ]
            },
            "Image": "nextcloud/aio-postgresql:latest",
            "Volumes": {
                "/mnt/data": {},
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "/start.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.centurylinklabs.watchtower.enable": "false"
            },
            "StopSignal": "SIGINT"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "0fbb274ab883242d9690ac2cd28806beca37bd06e09d57a7851b8edad83b4197",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/0fbb274ab883",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "nextcloud-aio": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "0fb8b9544931"
                    ],
                    "NetworkID": "411da493bfd46833f84540bc40f4a5eb8aa52ad5c04d7e2acf6a1846d740a0dd",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]