coreos 创建使用密钥登陆的ubuntu 基础镜像
来源:互联网 发布:淘宝卖家如何设置佣金 编辑:程序博客网 时间:2024/05/22 00:49
下载官方镜像
core@localhost ~ $ docker pull ubuntu:14.04#如果官方下载较慢,可到www.dockerpool.com下载标准镜像core@localhost ~ $ docker pull dl.dockerpool.com:5000/ubuntu:14.04core@localhost ~ $ docker tag dl.dockerpool.com:5000/ubuntu:14.04 ubuntu:14.04core@localhost ~ $ docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEdl.dockerpool.com:5000/ubuntu 14.04 1357f421be38 3 days ago 192.7 MBubuntu 14.04 1357f421be38 3 days ago 192.7 MB
创建dockerfile文件夹
core@localhost ~ $ mkdir basecore@localhost ~ $ cd basecore@localhost ~/base $~ $ ssh-keygen#生成访问密钥core@localhost ~/base $ cat ~/.ssh/id_rsa.pub >authorized_keys
dockerfile内容:
#设置母镜像FROM ubuntu:14.04#提供一些作者的信息MAINTAINER dwj_zz@163.com#下面开始运行命令,此处更改ubuntu的源为国内163的源RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.listRUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.listRUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.listRUN echo "deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.listRUN echo "deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.listRUN apt-get updateRUN apt-get upgrade -y#安装ssh 和supervisorRUN apt-get install -y openssh-server supervisorRUN mkdir -p /var/run/sshdRUN mkdir -p /var/log/supervisorRUN mkdir -p /root/.ssh#取消pam限制RUN sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd#复制配置文件到相应位置COPY supervisord.conf /etc/supervisor/conf.d/supervisord.confCOPY authorized_keys /root/.ssh/authorized_keys#开放端口EXPOSE 22CMD ["/usr/bin/supervisord"]
创建supervisor.conf文件:
core@localhost ~/base $ vi supervisord.conf#文件内容如下[supervisord]nodaemon=true[program:sshd]command=/usr/sbin/sshd -D
验证一下文件夹内容
core@localhost ~/base $ lsDockerfile authorized_keys supervisord.confcore@localhost ~/base $ pwd/home/core/base
创建image方法
core@localhost ~/base $ docker build -t base/163 .
启动容器命令
core@localhost ~/base $ docker run -p 100:22 -d base/163
使用密钥登陆容器
core@localhost ~/base $ ssh root@127.0.0.1 -p 100
1 1
- coreos 创建使用密钥登陆的ubuntu 基础镜像
- 使用ISO文件制作OpenStack使用的CoreOS镜像
- 为docker创建ubuntu带SSH的基础镜像
- 使用DockerFile创建ubuntu下的tomcat镜像
- docker创建ubuntu的lnmp镜像
- 使用密钥登陆SSH的方法
- 创建自定义的docker 基础镜像
- 使用密钥登陆Linux
- ubuntu ssh无密钥登陆
- Ubuntu 系统设置密钥登陆
- 使用vagrant和coreos创建kubernetes集群
- 创建和使用本地ubuntu source镜像服务器
- 创建和使用本地ubuntu source镜像服务器
- 制作openstack使用的Ubuntu镜像
- 创建 docker 基础镜像
- 使用Dockerfile创建一个带 ssh 服务的基础镜像
- putty使用密钥登陆OpenSSH
- putty使用密钥登陆OpenSSH
- nodejs http.requset options传字符串参数
- DWR框架中WebContext与WebContextFactory类
- github常见操作和常见错误!错误提示:fatal: remote origin already exists.
- 总也赶不上时髦!
- Ubuntu安装配置Mysql
- coreos 创建使用密钥登陆的ubuntu 基础镜像
- 吉布斯采样(Gibbs Sampling)
- 黑马程序员---入学测试题
- HTTPS和证书原理
- 分布式搜索elasticsearch 基本概念
- Android开源项目分类汇总
- ext控件重置
- 如何把QQ弄到博客上
- Ruby之散列与快排小程序