Skip to content

Instantly share code, notes, and snippets.

@RafaelPalomar
Last active May 31, 2019 06:49
Show Gist options
  • Save RafaelPalomar/407972f98621ffc4d774608a80565e00 to your computer and use it in GitHub Desktop.
Save RafaelPalomar/407972f98621ffc4d774608a80565e00 to your computer and use it in GitHub Desktop.
How to run a dockerized version of the nextcloud client #docker #nextcloud

Dockerized nextcloud-client

This explains how to setup nextcloud-client running in a docker container. The rationale behind this is that in Gentoo, the nextcloud client requires a version of SSL which casuses a lot of troubles (I eventually ended up with strong incompatibilities).

I prepared a simple docker image based on Ubuntu 18.04 to host the dockerized version of nextcloud client

FROM nvidia/opengl:1.0-glvnd-runtime

RUN apt update && apt install software-properties-common -y
RUN add-apt-repository ppa:nextcloud-devs/client && apt update -y
RUN apt install nextcloud-client -y
RUN useradd -u 1000 -m -g video user

Remember that in order to run the container with connection to the host Xorg you need to enable the right permissions. A solution (maybe not the best) is to use xhost +

A built image is publicly available in dockerhub at rafaelpalomar/docker-nextcloud-client

Systemd service

In order to load automatically nextcloud as a systemd service we create (gentoo) the file /etc/systemd/system/nextcloud-client@.service with the following content:

[Unit]
Description=Dockerized Nextcloud client
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop docker-nextcloud-client
ExecStartPre=-/usr/bin/docker rm docker-nextcloud-client
 ExecStart=nvidia-docker run --rm \
--name docker-nextcloud-client \
--net=host \
--device=/dev/dri \
-e DISPLAY=:0.0 \
-e XAUTHORITY=/home/user/.Xauthority \
--user=1000 \
-v /home/%i/nextcloud:/nextcloud \
-v /home/%i/.Xauthority:/home/user/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /home/%i/.config/Nextcloud:/home/user/.config/Nextcloud \
rafaelpalomar/docker-nextcloud-client nextcloud

[Install]
WantedBy=multi-user.target

Then you can enable the service as usual

Caveats

  • For an unknown reason, every time the service starts, nextcloud asks for credentials to login. Maybe the credentials are not stored in the .config/Nextcloud volume we mount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment