Public Repository

Last pushed: 2 years ago
Short Description
Setup a repository image with cvs/svn/git tool under rhel6.5
Full Description

[Prerequisite]

Setup a ftp yum in your local network and create the following ftp.repo:

[root@localhost rhel-repo]#cat ftp.repo

[ftp]

name=RHEL 6.5

baseurl=ftp://172.17.42.1/pub/rhel6.5

enabled=1

gpgcheck=1

gpgkey=ftp://172.17.42.1/pub/rhel6.5/RPM-GPG-KEY-redhat-release

Create a Dockerfile as follows:
[root@localhost rhel-repo]#cat Dockerfile

FROM richxsl/rhel6.5:min

MAINTAINER “Shiliang Xu” richxsl@163.com

VOLUME [“/data”]

COPY ftp.repo /etc/yum.repos.d/

RUN rpm -i http://mirror.centos.org/centos/6/os/x86_64/Packages/ftp-0.17-54.el6.x86_64.rpm

RUN yum -y install cvs.x86_64 subversion.x86_64 git.x86_64 && yum clean all

RUN yum -y localinstall http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum clean all

RUN yum -y install supervisor && yum clean all

RUN mkdir -p /var/run/sshd /var/log/supervisor

COPY supervisord.conf /etc/supervisord.conf

RUN ssh-keygen -q -N “” -t dsa -f /etc/ssh/ssh_host_dsa_key

RUN ssh-keygen -q -N “” -t rsa -f /etc/ssh/ssh_host_rsa_key

RUN sed 's@session\srequired\spam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

RUN echo 'root:repo' | chpasswd

EXPOSE 22

EXPOSE 2401

EXPOSE 3690

USER root

ENV HOME /root

ENV LANG en_US.UTF-8

WORKDIR /root

CMD /usr/bin/supervisord -c /etc/supervisord.conf

Create a supervisord.conf as follows:
[root@localhost rhel-repo]#cat supervisord.conf

[supervisord]

logfile=/var/log/supervisor/supervisord.log

logfile_maxbytes=50MB

logfile_backups=10

loglevel=info

pidfile=/var/run/supervisord.pid

nodaemon=true

minfds=1024

minprocs=200

[program:ssh]

priority=10

directory=/

command=/usr/sbin/sshd -D

user=root

autostart=true

autorestart=true

stopsignal=TERM

[Build]

[root@localhost rhel-repo]# ls

Dockerfile ftp.repo supervisord.conf

[root@localhost rhel-repo]#docker build -t richxsl/rhel6.5-repo .

[Usage]

docker run -d -p 2201:22 -p 2401:2401 -p 3690:3690 richxsl/rhel6.5-repo

You can use the following command to login the container:

ssh -l root -p 2201 [YOUR_CONTAINER_HOST]

That's all.

Docker Pull Command
Owner
richxsl

Comments (0)