- 使用dockerfile创建docker镜像
配置某个dockerfile文件时,需要自己动手在容器在容器中操作一遍,随后在dockerfile中复现该过程即可,对于一些需要交互的场景,可以使用管道,比如passwd --stdin# dockfile build ssh server from centos # base image FROM centos # maintainer information MAINTAINER xiaozhifc 1786614260@qq.com # install package needed RUN yum update -y RUN yum install --nogpgcheck openssh-server net-tools -y # shutdown the pam authentication RUN sed -i 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd # generate the necessary certificates RUN sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config RUN ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N "" RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" RUN ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" # change the linux root password RUN echo 'wodemima' | passwd --stdin root EXPOSE 22 # print the ip addr of container and start the sshd service CMD ifconfig eth0 | grep netmask | awk '{print $2}'; /usr/sbin/sshd -D
docker实例
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 摘要: 本文讲的是Docker使用自定义网桥docker,并且自定义容器的ip地址。 Docker 服务默认会创建...
- Centos/Redhat升级openssl/openssh服务 1、下载openssl-1.0.2h.tar.g...
- 系统巡检脚本:Version 2016.08.09 ############################ 系统...