Update running_ssh_service.md

Fixes #8390
This commit is contained in:
Dan Urson 2019-03-01 14:05:44 -05:00 committed by GitHub
parent 3948dcc901
commit a9f88ed3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -6,16 +6,24 @@ title: Dockerize an SSH service
## Build an `eg_sshd` image
### Generate a secure root password for your image
Using a static password for root access is dangerous. Create a random password before proceeding.
### Build the image
The following `Dockerfile` sets up an SSHd service in a container that you
can use to connect to and inspect other container's volumes, or to get
quick access to a test container.
quick access to a test container.
__Note: Replace "THEPASSWORDYOUCREATED" with the password that you created in the previous step.__
```Dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN echo 'root:THEPASSWORDYOUCREATED' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login