Start a centos docker container and connect using putty
Описание
how to start a centos container and connect it using putty
pre-requisite:
Docker should be installed in your system already
Steps:
1. open notepad
2. paste this
FROM centos:7
RUN yum -y install openssh-server
RUN /bin/sh
RUN useradd remote_user && \
echo 1234 | passwd remote_user --stdin && \
mkdir /home/remote_user/.ssh && \
chmod 700 /home/remote_user/.ssh
RUN chown remote_user:remote_user -R /home/remote_user/.ssh/ && \
/bin/sh
RUN /usr/sbin/sshd-keygen
CMD /usr/sbin/sshd -D
save it as Dockerfile
Note - .txt extension should not be there
3.open cmd and navigate to the path
4. docker build .
5. docker images
you will get a new image with unique image id created recently.
5. docker run -p 28:22 -d imageid
6. docker ps
you will see an instance running
7.open putty and connect
hostname: localhost
port 28
username: remote_host
password: 1234
Рекомендуемые видео



















