Skip to content

Instantly share code, notes, and snippets.

@TonyPepeBear
Last active May 17, 2022 09:43
Show Gist options
  • Save TonyPepeBear/2b9ccb5f7a0186ed6a3ec9643149b49e to your computer and use it in GitHub Desktop.
Save TonyPepeBear/2b9ccb5f7a0186ed6a3ec9643149b49e to your computer and use it in GitHub Desktop.
ubuntu-ssh
version: "3.2"
services:
ubuntu1:
image: ubuntu:ssh
ports:
- "8001:22"
ubuntu2:
image: ubuntu:ssh
ports:
- "8002:22"
ubuntu3:
image: ubuntu:ssh
ports:
- "8003:22"
ubuntu4:
image: ubuntu:ssh
ports:
- "8004:22"
ubuntu5:
image: ubuntu:ssh
ports:
- "8005:22"
ubuntu6:
image: ubuntu:ssh
ports:
- "8006:22"
ubuntu7:
image: ubuntu:ssh
ports:
- "8007:22"
ubuntu8:
image: ubuntu:ssh
ports:
- "8008:22"
ubuntu9:
image: ubuntu:ssh
ports:
- "8009:22"
ubuntu10:
image: ubuntu:ssh
ports:
- "8010:22"
ARG UBUNTU_VERSION=latest
FROM ubuntu:${UBUNTU_VERSION}
ENV DEBIAN_FRONTEND noninteractive
RUN apt update \
&& apt install -y openssh-server ssh sudo git vim \
&& useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu \
&& echo "ubuntu:ubuntu" | chpasswd \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& service ssh start
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment