[英]connect to docker's running container
I downloaded centos/centos7.1.1503 from docker's official hub, and created my custom dockerfile as below. 我从Docker的官方中心下载了centos / centos7.1.1503,并如下创建了我的自定义dockerfile。
FROM centos:centos7.1.1503
RUN yum install -y passwd
RUN echo -e “root\nroot” | (passwd --stdin root)
RUN yum update -y
RUN yum install -y git-core build-essential libssl-dev
CMD /var/tmp | git clone git://git.openwrt.org/14.07/openwrt.git
I then ran the following 3 commands 然后我运行了以下3个命令
docker build -t centos:test
docker run centos:test
docker attach <containerid>
It asks me for a password. 它要求我输入密码。 The password i set in the docker file doesn't work at all.
我在docker文件中设置的密码根本不起作用。 Any idea?
任何想法?
An idea is to change this line 一个想法是改变这一行
RUN echo -e “root\nroot” | (passwd --stdin root)
to this one: 对此:
RUN echo root | passwd root --stdin
Otherwise you are trying to set root\\nroot
as your root password (including that strange newline). 否则,您尝试将
root\\nroot
设置为root密码(包括该奇怪的换行符)。
An other try would be this (if you have xargs
available): 另一个尝试是这样(如果您有
xargs
可用):
RUN echo root | xargs passwd root
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.