2014-02-18 51 views
1

我使用从(http://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/)采取了以下dockerfile:相同dockerfiles给予不同的行为

FROM ubuntu

RUN dpkg-divert --local --rename --add /sbin/initctl

RUN ln -s /bin/true /sbin/initctl

RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list

RUN apt-get update

RUN apt-get upgrade -y

RUN apt-get -y install mysql-client mysql-server

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

ADD ./startup.sh /opt/startup.sh

EXPOSE 3305

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

这工作没有任何错误,当我在泊坞版本0.8建立我的本地机器上。

我一直在尝试与信任的建立: https://index.docker.io/u/hardingnj/sqlcontainer/

然而

泊坞窗的服务器我得到了第二次运行命令的错误上:

[91mln: failed to create symbolic link `/sbin/initctl': File exists

[0m

Error: build: The command [/bin/sh -c ln -s /bin/true /sbin/initctl] returned a non-zero code: 1

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

回答

2

有可能ubuntu镜像的版本不同。要非常精确,您可以在FROM语句中提供您想要的完整图像标识,例如

# 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 
... 
+0

谢谢,这是一个好主意。我会尝试并更新。 – hardingnj

相关问题