J2EEベアイメージ作成時に使用するDockerfileの定義内容を以下の図に記載します。
なお、以下の図は、ベースイメージにregistry.access.redhat.com/rhel7.3を使用する例です。赤字の部分は環境に合わせて修正してください。
# Get Base image
FROM registry.access.redhat.com/rhel7.3
# Create directories
RUN mkdir /work /interstage
# Copy Interstage install DVD to the docker image
COPY ./iaps /work/iaps
# Copy parameter csv file to the docker image
COPY ./j2ee.csv /work/j2ee.csv
# Copy shell scripts to the docker image
COPY ./interstage /interstage
RUN chmod 0544 /interstage/backup_restore/* /interstage/probe/*
# Set Japanese locale
ARG install_langs="ja_JP.utf8"
ARG lang_env="ja_JP.UTF-8"
RUN /bin/sed -i -e "/^override_install_langs/s/$/,${install_langs}/g" \
/etc/yum.conf; \
/bin/sed -i -e "s/^LANG=.*/LANG=${lang_env}/g" /etc/locale.conf; \
/bin/yum -y reinstall glibc-common && /bin/yum clean all -y
ENV LANG=${lang_env} LANGUAGE="${lang_env}" LC_ALL="${lang_env}"
# Set Japanese time zone
ARG timezone="Asia/Tokyo"
RUN /bin/yum -y reinstall tzdata && /bin/yum clean all -y; \
/bin/ln -snf /usr/share/zoneinfo/${timezone} /etc/localtime
# Set up systemd
ENV container docker
RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
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/*
# Install rpms for Interstage
RUN yum -y install cpp.x86_64 gcc.x86_64 gcc-c++.x86_64 gdb.x86_64 \
glibc-devel.x86_64 glibc-headers.x86_64 krb5-workstation.x86_64 \
libICE.x86_64 libSM.x86_64 libX11.x86_64 libX11-common.noarch \
libXau.x86_64 libXext.x86_64 libXi.x86_64 libXp.x86_64 \
libXrender.x86_64 libXt.x86_64 libXtst.x86_64 libstdc++-devel.x86_64 \
libtool-ltdl.x86_64 libxcb.x86_64 mpfr.x86_64 perl.x86_64 \
perl-Module-Pluggable.noarch perl-Pod-Escapes.noarch \
perl-Pod-Simple.noarch perl-libs.x86_64 perl-version.x86_64 \
redhat-lsb.x86_64 strace.x86_64 tcsh.x86_64 unixODBC.x86_64 \
lksctp-tools.x86_64 kernel-headers.x86_64 systemd.x86_64 \
rsyslog.x86_64 iproute.x86_64
# Install syslogd
RUN yum install -y rsyslog
RUN sed 's/$ModLoad imjournal/# $ModLoad imjournal/' \
-i /etc/rsyslog.conf && \
sed 's/$OmitLocalLogging on/$OmitLocalLogging off/' \
-i /etc/rsyslog.conf && \
sed 's/$IMJournalStateFile imjournal.state/# \
$IMJournalStateFile imjournal.state/' \
-i /etc/rsyslog.conf
# For minimum ipc resources
RUN echo '### for IAPS ###' >> /etc/sysctl.conf && \
echo 'kernel.sem = 1100 35406 200 1600' >> /etc/sysctl.conf && \
echo 'kernel.shmall = 4294967296' >> /etc/sysctl.conf && \
echo 'kernel.shmmax = 68719476736' >> /etc/sysctl.conf && \
echo 'kernel.shmmni = 4315' >> /etc/sysctl.conf && \
echo 'kernel.msgmax = 65536' >> /etc/sysctl.conf && \
echo 'kernel.msgmnb = 4194304' >> /etc/sysctl.conf && \
echo 'kernel.msgmni = 8199' >> /etc/sysctl.conf
# Change kernel parameters and remove IPCs before systemd start
RUN echo '' >> /etc/rc.local && \
echo '# change kernel parameters' >> /etc/rc.local && \
echo '/usr/sbin/sysctl -p' >> /etc/rc.local && \
echo '# remove IPCs before systemd start' >> /etc/rc.local && \
echo "QUES=\`/usr/bin/ipcs -q | /usr/bin/grep 0x | \
/usr/bin/awk '{ print(\$2) }' | \
/usr/bin/tr '\n' ' ' \`" >> /etc/rc.local && \
echo "MSGS=\`/usr/bin/ipcs -m | /usr/bin/grep 0x | \
/usr/bin/awk '{ print(\$2) }' | \
/usr/bin/tr '\n' ' ' \`" >> /etc/rc.local && \
echo "SEMS=\`/usr/bin/ipcs -s | /usr/bin/grep 0x | \
/usr/bin/awk '{ print(\$2) }' | \
/usr/bin/tr '\n' ' ' \`" >> /etc/rc.local && \
echo '' >> /etc/rc.local && \
echo 'for QUE in ${QUES}' >> /etc/rc.local && \
echo 'do' >> /etc/rc.local && \
echo ' /usr/bin/ipcrm -q ${QUE}' >> /etc/rc.local && \
echo 'done' >> /etc/rc.local && \
echo '' >> /etc/rc.local && \
echo 'for MSG in ${MSGS}' >> /etc/rc.local && \
echo 'do' >> /etc/rc.local && \
echo ' /usr/bin/ipcrm -m ${MSG}' >> /etc/rc.local && \
echo 'done' >> /etc/rc.local && \
echo '' >> /etc/rc.local && \
echo 'for SEM in ${SEMS}' >> /etc/rc.local && \
echo 'do' >> /etc/rc.local && \
echo ' /usr/bin/ipcrm -s ${SEM}' >> /etc/rc.local && \
echo 'done' >> /etc/rc.local && \
/usr/bin/chmod u+x /etc/rc.local && \
/usr/bin/systemctl enable rc-local.service > /dev/null 2>&1
# Install unit files for Interstage
COPY ./unitfiles/FJSVisas_start.service /lib/systemd/system
COPY ./unitfiles/FJSVisas_inspect_start.service /lib/systemd/system
RUN /usr/bin/chmod 0644 /lib/systemd/system/FJSVisas_start.service && \
/usr/bin/systemctl enable FJSVisas_start.service && \
/usr/bin/chmod 0644 \
/lib/systemd/system/FJSVisas_inspect_start.service && \
/usr/bin/systemctl enable FJSVisas_inspect_start.service
# Install Interstage
ENV CIR_INST_SKIP yes
ENV TERM xterm
RUN /work/iaps/installer/install.sh -s /work/j2ee.csv
# Specify executable when run this docker image
CMD [ "/usr/sbin/init" ]
# Remove Interstage installer
RUN rm -fr /work/j2ee.csv /work/iaps
# Set root password
RUN echo "root:<rootのパスワード>" | chpasswd
# Stop Interstage
RUN /opt/FJSVisas/bin/isservicestop.sh
# Setting Interstage envioment
RUN ismodifyservice -a FJapache
RUN ismodifyservice -m mode1