Cannot log in to Dockerized SSH daemon service using Ubuntu 16.04
<p>When I execute the example below from the <a href="https://docs.docker.com/engine/examples/running_ssh_service/" rel="nofollow">Docker website</a>, it works fine. As soon as I change it to <code>ubuntu:16.04</code>, however, the <code>screencast</code> password never works. It just keeps prompting to enter the correct password. Is there something different in <code>16.04</code> regarding the <code>chpasswd</code>?</p>

<pre><code># sshd
#
# VERSION               0.0.2

FROM ubuntu:14.04
MAINTAINER Sven Dowideit &lt;SvenDowideit@docker.com&gt;

RUN apt-get update &amp;&amp; apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# 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

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" &gt;&gt; /etc/profile

EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
</code></pre>

<p>Update: I also tried replacing the last line <code>CMD ["/usr/sbin/sshd", "-D"]</code> with <code>RUN service ssh restart</code>, but it still doesn't work. Makes me curious about when to use <code>service ssh restart</code> versus <code>/usr/sbin/sshd -D</code></p>