Start sshd automatically with docker container

Dmitry Erokhin picture Dmitry Erokhin · Apr 5, 2014 · Viewed 66.7k times · Source

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?

Answer

Jia picture Jia · Aug 24, 2015

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?