Docker image doesn't work

I’m trying to run syncloud from Docker, as described on github

docker run \
  --restart=always \
  --name=syncloud \
  --volume=/var/lib/syncloud:/opt/disk/internal \
  --privileged \
  --detach=true \
  --publish=443:443 \
  --publish=80:80 \
  syncloud/platform-amd64

the container seems to be running, but there’s nothing in logs. No service is listening on any exposed port.

systemd-journald[22]: Received request to flush runtime journal from PID 1
snapd[2095736]: udevmon.go:149: udev event error: Unable to parse uevent, err: cannot parse libudev event: invalid env data
snapd[2095736]: udevmon.go:149: udev event error: Unable to parse uevent, err: cannot parse libudev event: invalid env data
snapd[2095736]: udevmon.go:149: udev event error: Unable to parse uevent, err: cannot parse libudev event: invalid env data
snapd[2095736]: udevmon.go:149: udev event error: Unable to parse uevent, err: cannot parse libudev event: invalid env data
systemd-logind[1149]: Watching system buttons on /dev/input/event1 (Power Button)
systemd-udevd[2100778]: sda: /etc/udev/rules.d/60-ssd-scheduler.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler}, ignoring: Invalid argument
systemd-logind[1149]: Watching system buttons on /dev/input/event0 (Power Button)
systemd-udevd[2100590]: sdd: /etc/udev/rules.d/60-ssd-scheduler.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0/block/sdd/queue/scheduler}, ignoring: Invalid argument
kernel: kvm: disabled by bios
systemd-udevd[2100769]: sdb: /etc/udev/rules.d/60-ssd-scheduler.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb/queue/scheduler}, ignoring: Invalid argument
kernel: kvm: disabled by bios
systemd-udevd[2100751]: sdc: /etc/udev/rules.d/60-ssd-scheduler.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sdc/queue/scheduler}, ignoring: Invalid argument
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
ntpd[2657]: Listen normally on 43 docker0 172.17.0.1:123
ntpd[2657]: Listen normally on 44 docker0 [fe80::42:2aff:fe10:d91c%3]:123
ntpd[2657]: bind(29) AF_INET6 fe80::7480:94ff:fe3b:9742%33#123 flags 0x11 failed: Cannot assign requested address
ntpd[2657]: unable to create socket on veth3d142e1 (45) for fe80::7480:94ff:fe3b:9742%33#123
ntpd[2657]: failed to init interface for address fe80::7480:94ff:fe3b:9742%33
ntpd[2657]: new interface(s) found: waking up resolver
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios
kernel: kvm: disabled by bios

is docker still supported or do I have to install syncloud on raw device? The OS is Ubuntu 20.04.2, docker version 20.10.7

You should be able to.
Do you have any other container listening on the same ports?
Can you paste the output of docker ps?
It may take few minutes to start the whole system inside the container depending on your resources.
Also are you on a VM or a physical box?

No, there’s no port conflict.

Funny, now it seems to be running, I was probably too impatient. I was confused by empty docker logs. It might be helpful to mount /var/snap/platform/common/log to the host machine. Or probably the whole /var/snap/platform directory should uses as volume in order to persist data between Docker container restarts?

Though, I’ve switched to different Docker image. I’ve tried using syncloud/platform-buster-amd64

Docker image is used in our automated testing pipeline so it is guaranteed to be functioning correctly. As a result we gave it out as one of the ways of using Syncloud, but this is not our goal, it is just a result of a flexible build system we are using.

If you know what are you doing feel free to tweak and even propose changes to the documentation.

Our main goal is to help people who never heard of docker/linux and just want to keep their data off the cloud.

I believe in my case one of the problems is /etc/fstab

root@6d295c4bd55c:/# cat /etc/fstab 
/dev/sda2 / ext4 errors=remount-ro 0 1
/dev/sda1 none swap sw 0 0

this creates unnecessary timeouts during startup:

Jul 24 08:31:45 947afe9be92f systemd[1]: dev-sda1.device: Job dev-sda1.device/start timed out.
Jul 24 08:31:45 947afe9be92f systemd[1]: Timed out waiting for device /dev/sda1.
Jul 24 08:31:45 947afe9be92f systemd[1]: Dependency failed for /dev/sda1.
Jul 24 08:31:45 947afe9be92f systemd[1]: Dependency failed for Swap.
Jul 24 08:31:45 947afe9be92f systemd[1]: swap.target: Job swap.target/start failed with result 'dependency'.
Jul 24 08:31:45 947afe9be92f systemd[1]: dev-sda1.swap: Job dev-sda1.swap/start failed with result 'dependency'.
Jul 24 08:31:45 947afe9be92f systemd[1]: dev-sda1.device: Job dev-sda1.device/start failed with result 'timeout'.
Jul 24 08:31:45 947afe9be92f systemd[1]: Reached target System Initialization.

Also some systemd units are invalid, like (missing getty@.service file)

root@0d1f7ae83971:/# ls -laF /lib/systemd/system/autovt@.service
lrwxrwxrwx 1 root root 14 Oct 24  2020 '/lib/systemd/system/autovt@.service' -> 'getty@.service'

Then there’s timeout on network:

Jul 25 09:03:03 a5151bd4c55c systemd[1]: sys-subsystem-net-devices-eth0.device: Job sys-subsystem-net-devices-eth0.device/start timed out.
Jul 25 09:03:03 a5151bd4c55c systemd[1]: Timed out waiting for device /sys/subsystem/net/devices/eth0.
Jul 25 09:03:03 a5151bd4c55c systemd[1]: Dependency failed for ifup for eth0.
Jul 25 09:03:03 a5151bd4c55c systemd[1]: ifup@eth0.service: Job ifup@eth0.service/start failed with result 'dependency'.
Jul 25 09:03:03 a5151bd4c55c systemd[1]: sys-subsystem-net-devices-eth0.device: Job sys-subsystem-net-devices-eth0.device/start failed with result 'timeout'.

However, the main issue with Docker is, that the platform data isn’t persisted between container restarts. Ideally the path /var/snap/platform should be mounted as Docker volume, e.g.:

docker run \
  --restart=always \
  --name=syncloud \
  --volume=/var/lib/syncloud:/opt/disk/internal \
  --volume=/opt/syncloud:/var/snap/platform \
  --privileged \
  --detach=true \
  --publish=443:443 \
  --publish=80:80 \
  syncloud/platform-amd64

but is doesn’t work, as syncloud won’t create directory structure in mounted volume. From Docker it appears as:

/dev/md0 on /var/snap/platform type ext4 (rw,relatime,errors=remount-ro,stripe=256)

Would it be possible to support Docker volumes for platform data?

I see, did you copy the contents of this dir to the host before mounting it?

I’ve tried both. Copying existing data and staring with an empty directory. Both with the same result.

By the way, docker does not lose containers filesystem changes between restarts unless you create a new container from the image. What exactly are you trying to fix?

What about syncloud upgrades? How do you plan to persist data after Docker image upgrade?

Actually we almost never upgrade OS itself as everything is included in the platform package which you can upgrade from Settings - Updates - System.
But even if we wanted to upgrade kernel (one of the things we do not ship in platform package) it would not help docker as it uses host OS kernel.
Syncloud Docker image is like a full device (without kernel) running the full systemd init process as real device does.
We are ready to improve things in docker if it solves real issues.

Missing data backup is not an issue?

All your data generated by apps (files) will be here:

--volume=/var/lib/syncloud:/opt/disk/internal

If you want to backup app settings which are stored under corresponding /var/snap/[app] you can use backup feature from the app page. Backups are stored under the above volume so you can migrate everything to another container if you want just using this volume.