From 7df9c92d39bc68e83b0ddd2510364dfcf3ccf53a Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:47:51 +0530 Subject: [PATCH] add a script file to spawn a docker container --- scripts/create-docker-ssh-container.sh | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 scripts/create-docker-ssh-container.sh diff --git a/scripts/create-docker-ssh-container.sh b/scripts/create-docker-ssh-container.sh new file mode 100755 index 000000000..ecdbf21ee --- /dev/null +++ b/scripts/create-docker-ssh-container.sh @@ -0,0 +1,35 @@ +# create the docker file + +cat > Dockerfile << 'EOF' +FROM ubuntu:latest +ENV DEBIAN_FRONTEND=noninteractive +# Install SSH server +RUN apt-get update && apt-get install -y openssh-server +# Configure SSH +RUN mkdir /var/run/sshd +RUN echo 'root:my_password' | chpasswd +# Allow root login +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +# SSH login fix +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] +EOF + +docker build -t continue-ubuntu-ssh . # build the image + +rm Dockerfile # remove the created Dockerfile + +container_name="continue-ssh-container" + +docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container + +echo "docker container ${container_name} running on port 2222" + +# add the instructions +bold=$(tput bold) +normal=$(tput sgr0) + +echo "\n--------------------------------------" +echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}" +echo "use the following password - \"${bold}my_password${normal}\""