【问题标题】:Different problems when run in Dockerfile vs. manually. What's gone wrong?在 Dockerfile 与手动运行时会出现不同的问题。出了什么问题?
【发布时间】:2016-02-02 01:02:46
【问题描述】:

我正在尝试为 CiviCRM 创建一个可靠的 Docker 映像,因为 Docker 中心中没有与 README 或可读 Dockerfile 构建代码捆绑在一起的任何映像。唯一有据可查的图像不符合标准 Docker 约定。这是项目:https://github.com/djcf/civibuild-docker

所以,我编写了这个 Dockerfile,它使用 CiviCRM buildkit 进行标准安装。唯一的问题是它不起作用。大约一周前我让它工作了,但现在我没有做任何事情来构建它是成功的。 (当我第一次尝试在 Docker 中安装 Civi 时,我什至尝试重新运行当前的 buildkit 提交 -- https://raw.githubusercontent.com/civicrm/civicrm-buildkit/666d74d1e862957986e3b91c3206e3717d7058a1/bin/civi-download-tools -- 不走运。

Dockerfile 非常简单。

FROM colstrom/fish:ubuntu
# (this adds the Friendly Interactive Shell to Ubuntu 14.04

ENV CIVITYPE drupal-clean
ENV CMS_ROOT /buildkit/build
ENV SITE_NAME "Civi"
ENV SITE_ID "civi"
ENV TMPDIR /buildkit/tmp

RUN apt-get update; apt-get install -y curl links ssmtp
RUN curl -Ls https://civicrm.org/get-buildkit.sh | bash -s -- --full --dir /buildkit

COPY dbconf.sh /buildkit
COPY postinstall.sh /buildkit

# This is the problem part -- 
# but it makes three different errors depending on what environment its run.
RUN /buildkit/bin/civibuild create civicrm --type drupal-clean --url http://localhost:80 --admin-pass 123

RUN apt-get install -y runit
RUN /buildkit/postinstall.sh; apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME /buildkit/build
VOLUME /var/lib/mysql

EXPOSE 80

ENTRYPOINT ["/usr/sbin/docker-entrypoint.sh"]

dbconf.sh 预安装脚本确保 MySQL 正在运行,并复制脚本所需的一些配置。特别是它确保 amp 可以与 MySQL 通信,该 amp 具有与 MySQL 通信的正确设置,并且该 bower 将接受由 root 用户运行。

现在奇怪的是。

当我运行构建脚本 (docker build -t civibuild .) 时,构建在 buildkit 构建命令的 开始 处失败: 第 15 步:运行 /buildkit/dbconf.sh ; /buildkit/bin/civibuild create civicrm --type drupal-clean --url http://localhost:80 --admin-pass 123

---> Running in 3f9999dbdb12
* Starting MySQL database server mysqld
 ...done.
* Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly.
Finished running pr-configuration, will now install CiviCRM using buildkit buildscript.
ln: failed to create symbolic link 'bower': File exists
The command '/bin/sh -c /buildkit/dbconf.sh ; /buildkit    /bin/civibuild create civicrm --type drupal-clean --url    http://localhost:80 --admin-pass 123' returned a non-zero code: 1

所以我尝试在香草 Ubuntu 14.04 Docker 映像中手动运行完全相同的步骤(docker run --it ubuntu:14.04 /bin/bash)。这一次,Civi 构建完成了大约一半,然后出现错误:

CiviCRM was isntalled successfully                 [ok]
/buildkit/app/config/drupal-clean/install.sh: line 42: 17650    
Segmentation fault      (core dumped) drush -y dis overlay

然后我尝试在 Vagrant 图像中手动运行完全相同的步骤。这次脚本成功完成。

【问题讨论】:

    标签: docker dockerfile civicrm


    【解决方案1】:

    该解决方案最终被追踪到无效的 docker build 缓存。在之前的运行中,bower 安装失败并且缓存保留了错误的符号链接。

    解决方案:使用 docker build --no-cache 运行。

    【讨论】:

      猜你喜欢
      • 2021-07-15
      • 1970-01-01
      • 2021-09-07
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      相关资源
      最近更新 更多