Przede wszystkim: czy masz ssh-server zainstalowany w kontenerze?
tak robie dokladnie to samo co w instrukcji wiec moj Dockerfile wyglada nastepujaco:
FROM ubuntu:latest
RUN apt update && apt install openssh-server sudo -y
# Create a user “sshuser” and group “sshgroup”
RUN groupadd sshgroup && useradd -ms /bin/bash -g sshgroup sshuser
# Create sshuser directory in home
RUN mkdir -p /home/sshuser/.ssh
# Copy the ssh public key in the authorized_keys file. The idkey.pub below is a public key file you get from ssh-keygen. They are under ~/.ssh directory by default.
COPY idkey.pub /home/sshuser/.ssh/authorized_keys
# change ownership of the key file.
RUN chown sshuser:sshgroup /home/sshuser/.ssh/authorized_keys && chmod 600 /home/sshuser/.ssh/authorized_keys
# Start SSH service
RUN service ssh start
# Expose docker port 22
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
Dockera uzywam od niedawna wiec mozliwe ze jakies posrednie kroki zle robie, byloby fajnie gdyby ktos mogl sprawdzic czy u Was ta krotka instrukcja dziala.