distracted-biologist
distracted-biologist

Reputation: 808

Identical dockerfiles giving different behaviours

I am using the following dockerfile taken from (http://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/):

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"]

This works with no errors when I build on Docker version 0.8 on my local machine.

I have been experimenting with trusted builds: https://index.docker.io/u/hardingnj/sqlcontainer/

however on the docker servers I get an error with the second RUN command:

[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

I was under the impression that Dockerfiles should work identically independently of context? Perhaps the versions of ubuntu that I am pulling aren't identical?

Upvotes: 1

Views: 600

Answers (1)

Andy
Andy

Reputation: 38237

It is possible that the versions of the ubuntu image are different. To be extremely precise you could give the full image id that you want in the FROM statement, e.g.

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

Upvotes: 2

Related Questions