From 7f34705b0c0cd39daaa46e53bf64401e9590d8b3 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 4 Mar 2016 09:16:10 -0500 Subject: [PATCH] Fixing up Dockerfiles some more to get tests passing fully --- test/utils/docker/centos7/Dockerfile | 4 +-- test/utils/docker/ubuntu1404/Dockerfile | 37 +++++++++++++++++++-- test/utils/docker/ubuntu1404/init-fake.conf | 13 ++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 test/utils/docker/ubuntu1404/init-fake.conf diff --git a/test/utils/docker/centos7/Dockerfile b/test/utils/docker/centos7/Dockerfile index 6abac609222..69450e0af19 100644 --- a/test/utils/docker/centos7/Dockerfile +++ b/test/utils/docker/centos7/Dockerfile @@ -33,9 +33,9 @@ RUN yum -y install \ python-pip \ python-setuptools \ python-virtualenv -RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +RUN /usr/bin/sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers RUN mkdir /etc/ansible/ -RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts +RUN /usr/bin/echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts VOLUME /sys/fs/cgroup /run /tmp ENV container=docker CMD ["/usr/sbin/init"] diff --git a/test/utils/docker/ubuntu1404/Dockerfile b/test/utils/docker/ubuntu1404/Dockerfile index a0144e56d5a..25493c1f86e 100644 --- a/test/utils/docker/ubuntu1404/Dockerfile +++ b/test/utils/docker/ubuntu1404/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:trusty RUN apt-get clean; apt-get update -y; RUN apt-get install -y \ debianutils \ + gawk \ git \ locales \ make \ @@ -10,6 +11,35 @@ RUN apt-get install -y \ subversion \ sudo \ unzip + +# helpful things taken from the ubuntu-upstart Dockerfile: +# https://github.com/tianon/dockerfiles/blob/4d24a12b54b75b3e0904d8a285900d88d3326361/sbin-init/ubuntu/upstart/14.04/Dockerfile +ADD init-fake.conf /etc/init/fake-container-events.conf + +# undo some leet hax of the base image +RUN rm /usr/sbin/policy-rc.d; \ + rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl +# remove some pointless services +RUN /usr/sbin/update-rc.d -f ondemand remove; \ + for f in \ + /etc/init/u*.conf \ + /etc/init/mounted-dev.conf \ + /etc/init/mounted-proc.conf \ + /etc/init/mounted-run.conf \ + /etc/init/mounted-tmp.conf \ + /etc/init/mounted-var.conf \ + /etc/init/hostname.conf \ + /etc/init/networking.conf \ + /etc/init/tty*.conf \ + /etc/init/plymouth*.conf \ + /etc/init/hwclock*.conf \ + /etc/init/module*.conf\ + ; do \ + dpkg-divert --local --rename --add "$f"; \ + done; \ + echo '# /lib/init/fstab: cleared out for bare-bones Docker' > /lib/init/fstab +# end things from ubuntu-upstart Dockerfile + RUN apt-get install -y \ python-coverage \ python-httplib2 \ @@ -22,9 +52,10 @@ RUN apt-get install -y \ python-setuptools \ python-virtualenv \ python-yaml -RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +RUN rm /etc/apt/apt.conf.d/docker-clean +RUN /bin/sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers RUN mkdir /etc/ansible/ -RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts +RUN /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts RUN locale-gen en_US.UTF-8 -ENV container=docker +ENV container docker CMD ["/sbin/init"] diff --git a/test/utils/docker/ubuntu1404/init-fake.conf b/test/utils/docker/ubuntu1404/init-fake.conf new file mode 100644 index 00000000000..f5db965051e --- /dev/null +++ b/test/utils/docker/ubuntu1404/init-fake.conf @@ -0,0 +1,13 @@ +# fake some events needed for correct startup other services + +description "In-Container Upstart Fake Events" + +start on startup + +script + rm -rf /var/run/*.pid + rm -rf /var/run/network/* + /sbin/initctl emit stopped JOB=udevtrigger --no-wait + /sbin/initctl emit started JOB=udev --no-wait + /sbin/initctl emit runlevel RUNLEVEL=3 --no-wait +end script