Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sshd #24

Open
asaphaaning opened this issue Jun 12, 2019 · 2 comments
Open

sshd #24

asaphaaning opened this issue Jun 12, 2019 · 2 comments

Comments

@asaphaaning
Copy link

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?

@adferrand
Copy link
Owner

adferrand commented Jun 12, 2019

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

@asaphaaning
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants