I need to allow SSH access to a container using Ruby image, how can I do this? It’s only for my development environment (I’ll set Jetbrains RubyMine to use the Ruby SDK on a running container instead of installing it in my Windows PC).
Generally you don’t; you use
docker exec to get a shell in a running container.
I don’t need a shell, I need to provide an IP and PORT to RubyMine so it can connect to the container.
Here is my Dockerfile how I did it so I can use Hadoop:
RUN apt-get update;apt-get install -y openjdk-8-jdk-headless wget openssh-server tar vim
RUN echo “root:training” | chpasswd
RUN sed -i ‘s/prohibit-password/yes/’ /etc/ssh/sshd_config
ADD ssh.tar /root/
RUN chown -R root:root /root/.ssh;chmod -R 700 /root/.ssh
RUN echo “StrictHostKeyChecking=no” >> /etc/ssh/ssh_config
RUN mkdir /var/run/sshd
ADD start.sh /
EXPOSE 22 8088 50070
CMD bash /start.sh
Those are optional…I added my personal ssh keys there so I do not have to enter a password
- echo “root:root”
chpasswd: (user “root) pam_chauthtok() failed, error:
Authentication token manipulation error
chpasswd: (line 1, user “root) password not changed