dockce启动httpd+git

一、说明:

conf目录下:主要copy的文件时httpd.conf,主要是配置apache可以访问到git并通过账号密码控制
git-team.htpasswd: 这个文件提供了初始化的用户,主要包含两个,分别是usertest/admin
[附件:httpd.conf]

[附件:git-team.htpasswd]

二、创建DockerFile

FROM centos:centos7
MAINTAINER Imagine Lin<>
ENV
COPY git-team.htpasswd /opt/http_git/gitpasswd/git-team.htpasswd
RUN yum -y install git wget vim net net-tools grep awk sed exec httpd-2.4.6 httpd-devel-2.4.6 httpd-tools-2.4.6 && \
mkdir -p /opt/http_git/ud.git && \
cd /opt/http_git/ud.git && \
git init --bare && \
chown -R apache:apache /opt/http_git && \
chown apache:apache /opt/http_git/gitpasswd/git-team.htpasswd && \
chmod 640 /opt/http_git/gitpasswd/git-team.htpasswd
COPY conf /etc/httpd/conf
EXPOSE 80
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]

三、构建镜像

#uyw-git: 是镜像名称。1.0是tag名称
docker build -t uyw-git:1.0 .

四、运行镜像

docker run -d -it -p 10000:80 --name uyw-git -v dataVolumeGit1:/opt/http_git/gitpasswd uyw-git:1.0

相关推荐