Update Dockerfile
Browse files- Dockerfile +11 -11
Dockerfile
CHANGED
|
@@ -17,20 +17,20 @@
|
|
| 17 |
|
| 18 |
# CMD ["docker-compose up"]
|
| 19 |
|
| 20 |
-
|
| 21 |
FROM ubuntu:latest
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
|
| 26 |
-
|
| 27 |
-
RUN echo 'test:test' | chpasswd
|
| 28 |
-
RUN ssh-keygen -A
|
| 29 |
-
|
| 30 |
-
RUN service ssh start
|
| 31 |
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
| 17 |
|
| 18 |
# CMD ["docker-compose up"]
|
| 19 |
|
| 20 |
+
# Use a base image with an SSH server (you can choose a specific image based on your requirements)
|
| 21 |
FROM ubuntu:latest
|
| 22 |
|
| 23 |
+
# Update the package lists and install the SSH server
|
| 24 |
+
RUN apt-get update && apt-get install -y openssh-server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
# Create an SSH user (replace "sshuser" with your desired username)
|
| 27 |
+
RUN useradd -m -d /home/sshuser -s /bin/bash sshuser
|
| 28 |
|
| 29 |
+
# Set a password for the SSH user (replace "sshpassword" with your desired password)
|
| 30 |
+
RUN echo 'sshuser:sshpassword' | chpasswd
|
| 31 |
|
| 32 |
+
# Expose port 7768 for SSH
|
| 33 |
+
EXPOSE 7768
|
| 34 |
|
| 35 |
+
# Start the SSH server when the container runs
|
| 36 |
+
CMD ["/usr/sbin/sshd", "-D"]
|