我正在使用以下来自(http://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/)的dockerfile:
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"]
当我在本地计算机上构建Docker版本0.8时,此操作没有错误。
我一直在尝试可信赖的版本:
https://index.docker.io/u/hardingnj/sqlcontainer/
但是在docker服务器上,第二个RUN命令出现错误:
[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版本不完全相同?
最佳答案
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
...
关于docker - 具有相同行为的相同dockerfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21844252/