Sign inSign up

mcas/alpine-sshd

By mcas

•Updated over 3 years ago

Alpine image with OpenSSH Server

Image
0

232

mcas/alpine-sshd repository overview

Dockerfile :

FROM alpine:latest
RUN apk add --update --no-cache openssh vim wget git curl bash sudo
RUN echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
RUN adduser -h /home/alpine -s /bin/bash -D alpine
RUN echo "alpine ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/alpine
RUN echo -n 'alpine:alpine' | chpasswd
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 22
COPY entrypoint.sh /

Execute :

chmod +x -v entrypoint.sh

and :

docker build -t mcas/alpine-sshd:latest .

entrypoint.sh

#!/bin/sh
ssh-keygen -A
exec /usr/sbin/sshd -D -e "$@"
docker run -itd  --name <container name> mcas/alpine-sshd:latest
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container name>
ssh alpine@<IP of container> with alpine/alpine

Tag summary

Content type

Image

Digest

sha256:35b149e31…

Size

20.9 MB

Last updated

over 3 years ago

docker pull mcas/alpine-sshd