linuxbox/Dockerfile

34 lines
1003 B
Docker

FROM ubuntu:22.04
USER root
# Update the system, install OpenSSH Server, and set up users
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y openssh-server git sudo udev software-properties-common locales
# Create user and set password for user and root user
ARG CODE_PASSWORD
RUN useradd -rm -d /home/code -s /bin/bash -g root -G sudo -u 1000 code && \
echo 'code:'$CODE_PASSWORD | chpasswd
# Set up configuration for SSH
RUN mkdir /var/run/sshd && \
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \
echo "export VISIBLE=now" >> /etc/profile
# Set the locale
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/CET apt-get -y install tzdata
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Expose the SSH port
EXPOSE 22
# Add firstrun.sh to runit
ADD dockerrun.sh /dockerrun.sh
RUN chmod +x /dockerrun.sh
# Run SSH
#CMD ["/usr/sbin/sshd", "-D"]
CMD ["/dockerrun.sh"]