Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
fix(router): docker build fails when apt archive is stale
Browse files Browse the repository at this point in the history
`apt-get update` before the first apt command seems to fix this
in general.
  • Loading branch information
mboersma committed Apr 15, 2014
1 parent 5b57f32 commit d9b8578
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion router/Dockerfile
Expand Up @@ -2,7 +2,8 @@ FROM deis/base
MAINTAINER Gabriel Monroy <gabriel@opdemand.com>

# install nginx
RUN apt-get install -yq python-software-properties
RUN apt-get update && \
apt-get install -yq python-software-properties
RUN add-apt-repository ppa:chris-lea/redis-server -y
RUN add-apt-repository ppa:nginx/stable -y
RUN apt-get update
Expand Down

7 comments on commit d9b8578

@carmstrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just move line 8 to before line 5/6.

@mboersma
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we have to do it twice I think: once up front, to make sure we can actually fetch python-software-properties. Which we have to have installed in order to do apt-add-repository. Then once we've added the new apt-get sources we need to apt-get update again.

@carmstrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, ok. It probably makes more sense to move the installing of python-software-properties to be after adding the repositories and updating then, to avoid updating twice. But if this fixes the build quickly...

@carmstrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's necessary as it is.. I'm not super familiar with python-software-properties. :shipit:

@mboersma
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python-software-properties provides add-apt-repository, so there's the chicken-and-egg. (There are other ways to add apt-get repositories, but add-apt-repository is so convenient.) But any apt-get install in a Dockerfile can fail if it wasn't preceded by an apt-get update, because otherwise we may get stale data from parent filesystem layers in deis/base (or even ubuntu:12.04). This used to bite everyone in the Docker world until they updated the mirrors that ubuntu:12.04 uses for apt-get, now it's less common.
So I think @gabrtv did this correctly except for not prefixing everything with apt-get update.

@carmstrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks for the knowledge. LGTM.

@gabrtv
Copy link
Member

@gabrtv gabrtv commented on d9b8578 Apr 15, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please sign in to comment.