Add CentOS 7 with Systemd

This commit is contained in:
Yoander Valdés Rodríguez 2024-12-10 18:30:25 -05:00
commit d3b620159d
3 changed files with 66 additions and 0 deletions

17
C7Sytemd/CentOS-Base.repo Normal file
View file

@ -0,0 +1,17 @@
[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

34
C7Sytemd/Dockerfile Normal file
View file

@ -0,0 +1,34 @@
FROM centos:7
ENV container docker
RUN rm -fv /etc/yum.repos.d/*.repo
# Base repo (Main)
COPY CentOS-Base.repo /etc/yum.repos.d/
# EPEL Repo
RUN yum -y install https://dl.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
RUN yum -y update
RUN yum install -y initscripts # for old "service"
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum -y install mariadb-server httpd
RUN yum clean all
RUN systemctl enable mariadb httpd
VOLUME [ "/sys/fs/cgroup" ]
EXPOSE 80 3306
CMD [ "/sbin/init", "u" ]

15
C7Sytemd/README Normal file
View file

@ -0,0 +1,15 @@
# Docker - Centos 7 - Multi service (Apache, MariaDB)
This docker definition
## Build
```
$ docker build -t c7ms .
```
## Run
```
$ docker run -d --name c7 --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /run/lock -p80:80 -p 3306:3306 c7ms
```