Demo_Docker / Dockerfile
ankpan18's picture
changed Dockerfile
b39a727
raw
history blame contribute delete
636 Bytes
# Use ubuntu as the base image
FROM ubuntu
# Install and enable SSH service
RUN apt-get update && apt-get install -y openssh-server
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# Set a password for the root user
RUN echo "root:Changeme" | chpasswd
# Create the sshuser account lol
RUN useradd -m -s /bin/bash sshuser
# Create and change ownership of the /run/sshd directory
USER root
RUN mkdir /run/sshd
RUN chown sshuser:sshuser /run/sshd
USER sshuser
# Expose the SSH port
EXPOSE 22
# Start the SSH service and run bash as the foreground process
ENTRYPOINT service ssh start && bash