【问题标题】:Identical dockerfiles giving different behaviours相同的 dockerfile 提供不同的行为
【发布时间】:2014-03-17 15:28:13
【问题描述】:

我正在使用以下来自 (http://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/) 的 dockerfile:

来自 ubuntu

运行 dpkg-divert --local --rename --add /sbin/initctl

运行 ln -s /bin/true /sbin/initctl

运行 echo "deb http://archive.ubuntu.com/ubuntu 精确主宇宙" > /etc/apt/sources.list

运行 apt-get 更新

运行 apt-get upgrade -y

运行 apt-get -y install mysql-client mysql-server

运行 sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf

添加./startup.sh /opt/startup.sh

暴露 3305

CMD ["/bin/bash", "/opt/startup.sh"]

当我在本地机器上构建 Docker 版本 0.8 时,这可以正常工作。

我一直在试验受信任的构建: https://index.docker.io/u/hardingnj/sqlcontainer/

但是在 docker 服务器上,第二个 RUN 命令出现错误:

[91mln: 未能创建符号链接 `/sbin/initctl': 文件存在

[0米

错误:构建:命令 [/bin/sh -c ln -s /bin/true /sbin/initctl] 返回非零代码:1

我的印象是 Dockerfile 应该独立于上下文以同样的方式工作?也许我拉的ubuntu版本不一样?

【问题讨论】:

    标签: docker


    【解决方案1】:

    ubuntu 镜像的版本可能不同。为了非常精确,您可以在 FROM 语句中给出您想要的完整图像 ID,例如

    # This is the id of the current Ubuntu 13.10 image.
    # The tag could move to a different image at a later time.
    FROM 9f676bd305a43a931a8d98b13e5840ffbebcd908370765373315926024c7c35e
    RUN dpkg-divert --local --rename --add /sbin/initctl
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-20
      • 2021-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-23
      相关资源
      最近更新 更多