IT/Docker

[Docker] Dockerfile : centos 6 7 , ubuntu 메모

월공 2021. 6. 8. 10:54
728x90
300x250

Centos6.10

FROM centos:centos6.10

#ENV SSH_PASSWORD=

# Install base tool
RUN yum -y install vim wget tar

RUN yum -y install \
  scl-utils \
  centos-release-scl-rh \\
  vim \
  wget \
  tar \
  curl \
  gcc \
  gcc-c++ \
  openssl-devel \
  bzip2-devel

# Install develop tool
RUN yum -y groupinstall development


# Install crontab service
RUN yum -y install vixie-cron crontabs

# Install MariaDB(Only Client)
RUN echo -e "[mariadb]" >> /etc/yum.repos.d/MariaDB.repo && \
    echo -e "name = MariaDB" >> /etc/yum.repos.d/MariaDB.repo && \
    echo -e "baseurl = http://yum.mariadb.org/5.5.67/centos6-amd64" >> /etc/yum.repos.d/MariaDB.repo && \
    echo -e "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >> /etc/yum.repos.d/MariaDB.repo && \
    echo -e "gpgcheck=1" >> /etc/yum.repos.d/MariaDB.repo && \
    yum -y install MariaDB-client


# Copy files for setting
ADD . /opt/

# Setting DateTime Zone
RUN cp -p /usr/share/zoneinfo/Asia/Seoul /etc/localtime

# Setup default path
WORKDIR /

# Private expose
#EXPOSE 80
#EXPOSE 22

# Volume for web server install
VOLUME ["/home/website","/home/config","/home/logs"]


# Start run shell
CMD ["bash"]

Centos6_php56

FROM centos:centos6

RUN yum repolist \
&& yum -y install vi vim \
&& yum -y install httpd  \
&& yum -y install initscripts  \
&& yum -y update

RUN rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

RUN yum clean all && \
    yum -y install php56w php56w-common

RUN cp -p /usr/share/zoneinfo/Asia/Seoul /etc/localtime

EXPOSE 80

CMD /bin/bash

ENTRYPOINT /usr/sbin/httpd -D FOREGROUND


Centos 7

FROM centos:centos7

#ENV SSH_PASSWORD=

# Install base tool
RUN yum -y install vim wget tar

# Install develop tool
RUN yum -y groupinstall development

# Install SSH Service
RUN yum install -y openssh-server passwd
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config && \
    echo "${SSH_PASSWORD}" | passwd "root" --stdin

# Install crontab service
RUN yum -y install vixie-cron crontabs


# Copy files for setting
ADD . /opt/

# Setting DateTime Zone
RUN cp -p /usr/share/zoneinfo/Asia/Seoul /etc/localtime

# Setup default path
WORKDIR /

# Private expose
EXPOSE 80

# Volume for web server install
#VOLUME ["/home/website","/home/config","/home/logs"]

# Start run shell
CMD ["bash"]

Ubuntu_php5

FROM ubuntu:12.04

#VOLUME ["/var/www"]

RUN apt-get update && \
    apt-get install -y \
      apache2 \
      php5 \
      php5-cli \
      libapache2-mod-php5 \
      php5-gd \
      php5-ldap \
      php5-mysql \
      php5-pgsql

#COPY apache_default /etc/apache2/sites-available/default
#COPY run /usr/local/bin/run
#RUN chmod +x /usr/local/bin/run
#RUN a2enmod rewrite

EXPOSE 80

CMD /bin/bash
728x90
300x250