You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
1.4 KiB

FROM debian:12
ENV container docker
RUN useradd --create-home vagrant \
&& echo "vagrant:vagrant" | chpasswd \
&& groupadd wheel \
&& usermod -a -G wheel vagrant
# allow vagrant to login
RUN cd ~vagrant \
&& mkdir .ssh \
&& echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > .ssh/authorized_keys \
&& chown -R vagrant:vagrant .ssh \
&& chmod 0700 .ssh \
&& chmod 0600 .ssh/authorized_keys
EXPOSE 22
# install sudo, sshd, git, python3
RUN apt-get update && apt-get install -y sudo openssh-server git python3 python3-pip
# Enable passwordless sudo for the "vagrant" user
RUN mkdir -p /etc/sudoers.d
RUN install -b -m 0440 /dev/null /etc/sudoers.d/vagrant
RUN echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/vagrant
# Use systemd replacement script to simulate systemd in Docker
# https://github.com/gdraheim/docker-systemctl-replacement
COPY systemctl3.py /usr/bin/systemctl
RUN test -e /bin/systemctl || ln -sf /usr/bin/systemctl /bin/systemctl
RUN chmod 0755 /usr/bin/systemctl
RUN systemctl enable ssh
CMD ["/usr/bin/systemctl"]