Given:
- container based on ubuntu:13.10
- installed ssh (via
apt-get install ssh
)
Problem: each when I start container I have to run sshd manually service ssh start
Tried: update-rc.d ssh defaults
, but it does not helps.
Question: how to setup container to start sshd service automatically during container start?
You can try a more elegant way to do that with phusion/baseimage-docker
https://github.com/phusion/baseimage-docker#readme
Just try:
ENTRYPOINT service ssh restart && bash
in your dockerfile, it works fun for me!
more details here: How to automatically start a service when running a docker container?
You can start ssh server when starting your container probably. Something like this:
docker run ubuntu /usr/sbin/sshd -D
Check out this official tutorial.
Well, I used the following command to solve that
docker run -i -t mycentos6 /bin/bash -c '/etc/init.d/sshd start && /bin/bash'