I would like to connect with SSH into my docker container. For that I created image with this Dockerfile and this command docker build -t test/toto . :
FROM ubuntu:14.04.4
MAINTAINER Darkomen <[email protected]>
# Let the conatiner know that there is no tty
ENV DEBIAN_FRONTEND noninteractive
RUN sudo apt-get -y update
RUN sudo apt-get -y install software-properties-common python-software-properties
RUN sudo add-apt-repository main
RUN sudo add-apt-repository universe
RUN sudo add-apt-repository restricted
RUN sudo add-apt-repository multiverse
RUN sudo apt-get -y update
#RUN sudo apt-get -y install linux-headers-$(uname -r) build-essential
RUN sudo apt-get -y install linux-headers-generic build-essential
RUN apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
RUN apt-get -y install curl unzip
RUN apt-get -y install software-properties-common
RUN apt-get -y install gnupg2
# others tools
RUN sudo apt-get -y install nano
RUN sudo apt-get -y install vim
RUN sudo apt-get -y install aptitude
RUN sudo apt-get -y install git
RUN sudo apt-get -y install openjdk-7-jdk
RUN sudo apt-get -y install whois
RUN sudo apt-get -y install dos2unix
# SSH
RUN apt-get -y install openssh-server
RUN mkdir -p /var/run/sshd
RUN echo 'root:screencast' |chpasswd
EXPOSE 22
CMD /usr/sbin/sshd -D
next I launched my container with this image with this command : docker run test/toto -p 42000:22
My container run perfectly and I launch this command for enter into this container : docker run -dt -p 42000:22 test/toto
Now my docker-machine and docker container (based on my dockerfile) run. I can view that because docker ps -a tell me that :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a28ad08fd393 test/toto "/bin/sh -c '/usr/sbi" 22 minutes ago Up 22 minutes 0.0.0.0:42000->22/tcp admiring_feynman
For connecting in my container I launch this command : ssh [email protected] -p 42000
But it tell me to enter a password. I try lot of thing but nothing run. What I do forget in my process of creation and configuration docker ?
192.168.99.100 is the IP return by the docker-machine inspect command
I also tried to change root password into my container and repeat ssh command access. But nothing change. I can't connecting to container.
technical information:
- OS : windows 7 Pro
- Docker version : 1.12.2 build bb80604
- Docker system : docker toolbox (based on VirtualBox)
- VirtualBox version : 5.0.14r105127
docker runwork?rootpassword?