Update Ubuntu docker images.

- Reduce image size by skipping recommended packages.
- Consolidate and sort packages to install.
- Improve consistency between Ubuntu versions.
- Combine apt-get update and install to avoid caching stale updates.
pull/16263/head
Matt Clay 9 years ago
parent 0cf9f9d715
commit 349b06974e

@ -1,9 +1,10 @@
FROM ubuntu:precise
RUN apt-get clean; apt-get update -y;
RUN apt-get install -y \
FROM ubuntu:12.04
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
acl \
apache2 \
asciidoc \
acl \
bzip2 \
cdbs \
debhelper \
@ -13,22 +14,40 @@ RUN apt-get install -y \
dpkg-dev \
fakeroot \
gawk \
gcc \
git \
libxml2-utils \
locales \
make \
mercurial \
mysql-server \
openssh-client \
openssh-server \
python-coverage \
python-dev \
python-httplib2 \
python-keyczar \
python-mock \
python-mysqldb \
python-nose \
python-paramiko \
python-pip \
python-setuptools \
python-virtualenv \
python-yaml \
reprepro \
rsync \
ruby \
rubygems \
subversion \
sudo \
openssh-client \
openssh-server \
unzip \
xsltproc \
zip \
xsltproc
&& \
apt-get clean
RUN pip install --upgrade jinja2 pycrypto
# helpful things taken from the ubuntu-upstart Dockerfile:
# https://github.com/tianon/dockerfiles/blob/4d24a12b54b75b3e0904d8a285900d88d3326361/sbin-init/ubuntu/upstart/14.04/Dockerfile
@ -58,29 +77,14 @@ RUN /usr/sbin/update-rc.d -f ondemand remove; \
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-dev \
python-httplib2 \
python-jinja2 \
python-keyczar \
python-mock \
python-mysqldb \
python-nose \
python-paramiko \
python-pip \
python-setuptools \
python-virtualenv \
python-yaml
RUN pip install --upgrade jinja2 pycrypto
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 /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
RUN locale-gen en_US.UTF-8
RUN ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
for key in /etc/ssh/ssh_host_*_key.pub; do echo "localhost $(cat ${key})" >> /root/.ssh/known_hosts; done
VOLUME /sys/fs/cgroup /run/lock /run /tmp
RUN pip install junit-xml
ENV container docker
ENV container=docker
CMD ["/sbin/init"]

@ -1,9 +1,10 @@
FROM ubuntu:trusty
RUN apt-get clean; apt-get update -y;
RUN apt-get install -y \
FROM ubuntu:14.04
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
acl \
apache2 \
asciidoc \
acl \
bzip2 \
cdbs \
debhelper \
@ -19,15 +20,30 @@ RUN apt-get install -y \
make \
mercurial \
mysql-server \
openssh-client \
openssh-server \
python-coverage \
python-httplib2 \
python-jinja2 \
python-keyczar \
python-mock \
python-mysqldb \
python-nose \
python-paramiko \
python-pip \
python-setuptools \
python-virtualenv \
python-yaml \
reprepro \
rsync \
ruby \
subversion \
sudo \
openssh-client \
openssh-server \
unzip \
xsltproc \
zip \
xsltproc
&& \
apt-get clean
# helpful things taken from the ubuntu-upstart Dockerfile:
# https://github.com/tianon/dockerfiles/blob/4d24a12b54b75b3e0904d8a285900d88d3326361/sbin-init/ubuntu/upstart/14.04/Dockerfile
@ -57,27 +73,14 @@ RUN /usr/sbin/update-rc.d -f ondemand remove; \
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 \
python-jinja2 \
python-keyczar \
python-mock \
python-mysqldb \
python-nose \
python-paramiko \
python-pip \
python-setuptools \
python-virtualenv \
python-yaml
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 /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
RUN locale-gen en_US.UTF-8
RUN ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
for key in /etc/ssh/ssh_host_*_key.pub; do echo "localhost $(cat ${key})" >> /root/.ssh/known_hosts; done
VOLUME /sys/fs/cgroup /run/lock /run /tmp
RUN pip install junit-xml
ENV container docker
ENV container=docker
CMD ["/sbin/init"]

@ -1,18 +1,10 @@
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
ENV container docker
RUN apt-get clean; apt-get update -y;
RUN echo 'APT::Install-Recommends "0"; \n\
APT::Get::Assume-Yes "true"; \n\
APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01buildconfig
RUN apt-get install -y \
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
acl \
apache2 \
asciidoc \
acl \
bzip2 \
cdbs \
curl \
@ -33,16 +25,8 @@ RUN apt-get install -y \
mysql-server \
openssh-client \
openssh-server \
python-dbus \
reprepro \
rsync \
ruby \
subversion \
sudo \
unzip \
zip \
xsltproc \
python-coverage \
python-dbus \
python-httplib2 \
python-jinja2 \
python-keyczar \
@ -54,20 +38,27 @@ RUN apt-get install -y \
python-setuptools \
python-virtualenv \
python-wheel \
python-yaml \
reprepro \
rsync \
ruby \
subversion \
sudo \
unzip \
virtualenv \
python-yaml
xsltproc \
zip \
&& \
apt-get clean
# some tests assume the .deb is cached
RUN rm /etc/apt/apt.conf.d/docker-clean
RUN mkdir /etc/ansible/
RUN /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
RUN locale-gen en_US.UTF-8
RUN ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
for key in /etc/ssh/ssh_host_*_key.pub; do echo "localhost $(cat ${key})" >> /root/.ssh/known_hosts; done
RUN mkdir /etc/ansible/
RUN /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
VOLUME /sys/fs/cgroup /run/lock /run /tmp
RUN pip install junit-xml
ENV container=docker
CMD ["/sbin/init"]

Loading…
Cancel
Save