zimbra+docker安装(方式一)

基于【zimbra安装步骤】做docker,zimbra本身很大做成的镜像近2G,也可能是我没有找到好方法。以下是我做镜像的步骤:

一、准备

主机要能联网

1、安装docker

docker尽量是稳定的新版本吧,下面是我的docker版本


# docker -v
Docker version 18.09.5, build e8ff056

2、文件包准备

root@servername:/docker# ls
Dockerfile  zcs-8.8.12_GA_3794.UBUNTU16_64.20190329045002.tgz

看一下Dockerfile

root@servername:/docker# cat Dockerfile 
From ubuntu:16.04
MAINTAINER jinn.zimbra:v1
RUN apt-get update && apt-get -y install \
dialog \
openssh-client \
software-properties-common \
dnsmasq \
dnsutils \
net-tools \
sudo \
rsyslog \
vim 

EXPOSE 22 25 465 587 110 143 993 995 80 443 8080 8443 7071

ADD zcs-8.8.12_GA_3794.UBUNTU16_64.20190329045002.tgz /opt

root@servername:/docker# 

二、做镜像zimbra:v1

root@servername:/docker# docker build -t zimbra:v1 .
root@servername:/docker#
root@servername:/docker# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
zimbra              v1                  f03147990e4b       3 weeks ago          558MB
ubuntu              16.04               2a697363a870        3 weeks ago         119MB

三、做镜像zimbra:v2

只有在docker run的时候也能指定主机名,这就决定了zimbra只能在起容器或者容器里安装,安装过程太长和老是报错,所以我决定安装一半然后commit成一个镜像。减轻起容器安装zimbra的负担。

 1、

root@servername:/docker#docker run -dit --name zimbrav1  --hostname three.mail.com zimbra:v1

2、进到容器里

root@servername:/docker#docker exec -it zimbra:v1 sh

3、主机名和DNS无需修改,已经是ok的

4、直接安装

# su root
root@three:/# cd /opt/zcs-8.8.12_GA_3794.UBUNTU16_64.20190329045002/
root@three:/opt/zcs-8.8.12_GA_3794.UBUNTU16_64.20190329045002# ./install.sh

Do you agree with the terms of the software license agreement? [N] y
Use Zimbra's package repository [Y] y
Install zimbra-ldap [Y] y
Install zimbra-logger [Y] y
Install zimbra-mta [Y] y
Install zimbra-dnscache [Y] n
Install zimbra-snmp [Y] n
Install zimbra-store [Y] y
Install zimbra-apache [Y] n
Install zimbra-spell [Y] n
Install zimbra-memcached [Y] y
Install zimbra-proxy [Y] y
Install zimbra-drive [Y] n
Install zimbra-imapd (BETA - for evaluation only) [N] n
he system will be modified.  Continue? [N] y
安装到这里百分之九十九会出错,错误解决请参考本姑娘的【zimbra安装】
预测是【zimbra安装】里的“错误提示一”
解决后,执行/opt/zimbra/libexec/zmsetup.pl
预测是【zimbra安装】里的“错误提示三”
解决后,执行/opt/zimbra/libexec/zmsetup.pl

……总之在出现DNS要你选择yes的时候如下:
DNS ERROR resolving three.mail.com
It is suggested that the hostname be resolvable via DNS
Change hostname [Yes]

按ctrl +  c 退出安装

5、commit成zimbra:v2

ctrl + d 退出容器

root@servername:/home/hyj# docker commit zimbrav1 zimbra:v2

过程较长

root@servername:/home/hyj# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
zimbra              v2                  b9ffe1dfebf2        4 days ago          1.89GB
zimbra              v1                  f03147990e4b        4 days ago          558MB
ubuntu              16.04               2a697363a870        3 weeks ago         119MB

三、做镜像zimbra:v3


root@servername:/docker/v2# ls
Dockerfile  key  start.sh



root@servername:/docker/v2# cat Dockerfile 

From zimbra:v2
MAINTAINER jinn-zimbrav3
COPY key /opt
COPY start.sh /opt
WORKDIR /opt
USER root
CMD ["/bin/bash","/opt/start.sh"]



root@servername:/docker/v2# cat key
No
No
5
4
hc@1006
r
a
y
y
y
y
y
root@servername:/docker/v2#
root@servername:/docker/v2#



root@servername:/docker/v2# cat start.sh 

sudo echo y | apt-get upgrade && apt-get autoclean && apt-get clean && apt-get autoremove
/opt/zimbra/libexec/zmsetup.pl < /opt/key && su - zimbra -c "zmcontrol restart"


root@servername:/docker/v2#
root@servername:/docker/v2#docker build -t zimbra:v3

root@servername:/docker/v2#docker run -it --name zimbrav3 -p 7071:7071 80:80 --hostname three.mail.com  zimbra:v3

等待安装成功,出现下图

zimbra+docker安装(方式一)_第1张图片

zimbra+docker安装(方式一)_第2张图片

 

成功

你可能感兴趣的:(zimbra邮件)