1.docker镜像的封装(httpd服务)
(1)编写yum文件
cd /tmp/docter
vim dvd.repo
[dvd-rhel]
name=dvd-rhel
baseurl=http://172.25.9.250/rhel7.3
gpgcheck=0
(2)编写镜像文件
vim Dockerfile
FROM rhel7
ENV HOSTNAME server1
MAINTAINER redhat@westos.org
EXPOSE 80
COPY dvd.repo /etc/yum.repos.d/dvd.repo
RUN rpmdb --rebuilddb && yum install -y httpd && yum clean all
VOLUME ["/var/www/html"]
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
docker build -t rhel7:v1 .
成功
docker images rhel7
docker run -d --name vm4 -v /tmp/docker/web/:/var/www/html rhel7:v1
2.docker镜像的封装(sshd服务)
(1