Public Repository

Last pushed: a year ago
Short Description
ubuntu:14.04-ssh 密码为654321
Full Description

执行运行命令为:docker run -d -p 10122:22 tjtjob/ubuntu14.04:ssh
登录密码为:654321

文件一:authorized_keys内容来源为:
宿主机执行$ssh-keygen -t rsa
$ cat ~/.ssh/id_rsa.pub > authorized_keys

文件二:run.sh 内容为:

#!/bin/bash
/etc/init.d/ssh start
tailf /var/log/dpkg.log

三:构建命令为:


FROM ubuntu:14.04
MAINTAINER tjt
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir -p /root/.ssh
RUN sed -i s/without-password/yes/g /etc/ssh/sshd_config
RUN echo root:654321 | chpasswd

#复制文件到指定的目录
ADD authorized_keys /root/.ssh/authorized_keys
ADD run.sh /run.sh
RUN chmod 755 /run.sh

#开放端口
EXPOSE 22

#设置自启动服务
CMD ["/run.sh"]


Docker Pull Command
Owner
tjtjob

Comments (0)