Changesets · Branches · Tags · Compare
| Changeset | 2b258fb0da4238277b5c7a2c871cf959353eec4ddeaca3daec6af2b6b0b3a57c |
|---|---|
| Author | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-06-25 19:47 +05:30 |
| Committer | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-06-25 19:47 +05:30 |
| Parents | 6739a12a7b3f |
1 file changed
added scripts/create-docker-ssh-container.sh +35 −0
| @@ -0,0 +1,35 @@ | ||
| 1 | +# create the docker file | |
| 2 | + | |
| 3 | +cat > Dockerfile << 'EOF' | |
| 4 | +FROM ubuntu:latest | |
| 5 | +ENV DEBIAN_FRONTEND=noninteractive | |
| 6 | +# Install SSH server | |
| 7 | +RUN apt-get update && apt-get install -y openssh-server | |
| 8 | +# Configure SSH | |
| 9 | +RUN mkdir /var/run/sshd | |
| 10 | +RUN echo 'root:my_password' | chpasswd | |
| 11 | +# Allow root login | |
| 12 | +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
| 13 | +# SSH login fix | |
| 14 | +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
| 15 | +EXPOSE 22 | |
| 16 | +CMD ["/usr/sbin/sshd", "-D"] | |
| 17 | +EOF | |
| 18 | + | |
| 19 | +docker build -t continue-ubuntu-ssh . # build the image | |
| 20 | + | |
| 21 | +rm Dockerfile # remove the created Dockerfile | |
| 22 | + | |
| 23 | +container_name="continue-ssh-container" | |
| 24 | + | |
| 25 | +docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container | |
| 26 | + | |
| 27 | +echo "docker container ${container_name} running on port 2222" | |
| 28 | + | |
| 29 | +# add the instructions | |
| 30 | +bold=$(tput bold) | |
| 31 | +normal=$(tput sgr0) | |
| 32 | + | |
| 33 | +echo "\n--------------------------------------" | |
| 34 | +echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}" | |
| 35 | +echo "use the following password - \"${bold}my_password${normal}\"" |