Jump to content

lylavoie

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by lylavoie

  1. Hi All, I saw this (I know its older), and had just worked on getting unison running in a container, but using SSH as the transport instead of the native TCP support. The reason for your issue with "hanging" the umount is because running unison as the server process keeps active connections. The Dockerfile below will build a container that can run unison, but via an SSH connection. It assumes a couple of things: Only 1 SSH user, and that user has a public key based auth. Only sync of one path from the container, "mounted" as a volume from the host The UID/GID values of the user are all synced between the unison client, container, and host. This isn't strictly required. To build this, just run "docker build -t unison-ssh ." in the directory with your public ssh key and the Dockerfile. Note, you should change the username, UID, and GID values as needed. FROM ubuntu:16.04 # Override the UID/GID values, because we need these to line up with the host's file system ENV USERUID=1000 USERGID=100 USERNAME=blah # Get us an updated OS and intall SSH RUN apt-get update && apt-get install -y openssh-server RUN mkdir /var/run/sshd # Install unison application RUN apt-get install unison # Random root password RUN NEW_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) && echo 'root:${NEW_PASS}' | chpasswd # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd # Create my user RUN useradd --uid 1000 --gid 100 --no-user-group --create-home $USERNAME && mkdir /home/$USERNAME/.ssh && chown $USERUID:$USERGID /home/$USERNAME/.ssh COPY --chown=$USERUID:$USERGID id_rsa.pub /home/$USERNAME/.ssh/authorized_keys # Create the place we're going to get our external sync storage from RUN mkdir /data && chown $USERUID:$USERGID /data VOLUME /data EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
×
×
  • Create New...