Hybris in Docker (1)

Submitted by Lizhe on Mon, 03/04/2019 - 08:30

这里首先我尝试了一下使用常规安装命令打了一个镜像

 

FROM centos:7 as base
MAINTAINER Lizhe "zhe.li4@pactera.com"

RUN yum -y install wget


COPY ./docker-init-files/hybris/jdk-8u201-linux-x64.rpm /opt/
RUN yum -y install /opt/jdk-8u201-linux-x64.rpm

RUN wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
     yum makecache && \
     yum -y install unzip 

RUN chmod -R 777 /opt

FROM base as pre-hybris

RUN groupadd notroot
RUN useradd -d /data -g notroot -m notroot

USER notroot
ENV JAVA_HOME /usr/java/jdk1.8.0_201-amd64

ENV HYBRIS_ZIP_NAME CXCOMM181100P_1-70004085.ZIP 
COPY ./docker-init-files/hybris/$HYBRIS_ZIP_NAME /opt/

WORKDIR /opt

RUN unzip ./$HYBRIS_ZIP_NAME 
RUN rm ./$HYBRIS_ZIP_NAME


RUN ./installer/install.sh -r b2c_acc setup
RUN ./installer/install.sh -r b2c_acc initialize
ENTRYPOINT /opt/installer/install.sh -r b2c_acc start

 

始终这种方式打的镜像实在是太大了

REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
lizhehybris              latest              d350d831a7de        2 hours ago         6.11GB

启动容器, 发现功能貌似还算正常

 

[lizhe@localhost lizhedocker]$ docker run -it --net=host --name=hy lizhehybris

20190304043659