adferrand/docker-backuppc

sshd

Opened this issue · 2 comments

Using sshd to backup localhost and some NFS mounted filesystems on it as well. I hacked this by adding openrc and enabling sshd but this seems to not persist through restarts.

Disclaimer: This question may not be specific to this repo and due to me being a docker-noob:
Is it possible to add a startup service like sshd to the container?

First I respond to your general question about processes in Dockers.

Normally a docker has only one process running, which defines the docker runtime itself: the process starts the docker, and when it is terminated for any reason, the docker is also stopped.

However, it is possible to make this only one process be a process manager, that will handle child processes. In regular Linux world, you certainly know systemd. In the Docker world, more suitable process managers are supervisord or circusd.

It is the case of my Docker, and I use circusd, which takes its configuration from the /etc/circus.ini inside the Docker. See the official documentation about this configuration file here: https://circus.readthedocs.io/en/latest/for-ops/configuration/

All of this to say that if the Docker is using a process manager, you can indeed extend the Docker and add more processes. And this is the case with this one.

You will need to build your own Docker on top of mine through a Dockerfile, and add the proper configuration to start the sshd process at the end of /etc/circus.ini. Hopefully the openssh package is already installed in the Docker, so the server is already available. A typical configuration entry for circus would be:

[env:sshd]
cmd = /usr/sbin/sshd
stdout_stream.class = FancyStdoutStream
stderr_stream.class = FancyStdoutStream

Any chance you would consider implementing this in the official dockerhub image?