admin/ December 9, 2016/ Docker, Linux/ 0 comments

Openssh server enabled in the Ubuntu 14.04 images on Docker.

Use the below Dockerfile for Ubuntu 14.04 ssh server.

FROM ubuntu:14.04
MAINTAINER Arvind Rawat <[email protected]>

RUN apt-get update && 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 '[email protected]\s*required\s*[email protected] optional [email protected]' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

CMD ["/usr/sbin/sshd", "-D"]

Git clone the repository

$ git clone

Get in the repository and make docker image build.

$ cd ssh 
$ docker build -t arvindr226/ubunutu14.04-ssh .

Docker run using below command.

$ docker -d --name ssh -p 2222:22 arvindr226/ubunutu14.04-ssh

To Check the ssh login like below

$ ssh [email protected] -p 2222

Default password-: screencast

Easiest way to use Ubuntu 14.04 with openssh server.

Pull the docker image like below-:

$ docker pull arvindr226/ubunutu14.04-ssh

Create a docker container service using below command.

$ docker run -d -p 2233:22 arvindr226/ubunutu14.04-ssh

To Connect the docker container use.

$ ssh [email protected] -p 2233
Share this Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.