Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use apt-get update && apt-get install, per Docker best practices #561

Merged
merged 1 commit into from May 2, 2017
Merged

Use apt-get update && apt-get install, per Docker best practices #561

merged 1 commit into from May 2, 2017

Conversation

ssbr
Copy link
Contributor

@ssbr ssbr commented May 2, 2017

https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

I ran into this because I was getting errors locally, like:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg/libdpkg-perl_1.18.4ubuntu1.1_all.deb  404  Not Found [IP: 91.189.88.149 80]

It turns out you get these if you don't update, and the official best practices are to run apt-get update && apt-get install. In fact, running any apt-get install command without the apt-get update && before it can result in unfortunate caching artifacts -- ctrl+f for "cache busting". (P.S. thanks to Peng on Freenode for helping me, I'm bad at Ubuntu.)

So:

sed -re \
    's/RUN apt-get ((-y )?(install|build-dep))/RUN apt-get update \&\& apt-get \1/' -i \
    projects/**/Dockerfile

I also manually fixed the cases that already ran apt-get update in their Dockerfile:

  • dlplibs/Dockerfile
  • grpc/Dockerfile
  • libreoffice/Dockerfile

  https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

I ran into this because I was getting errors locally, like:

    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg/libdpkg-perl_1.18.4ubuntu1.1_all.deb  404  Not Found [IP: 91.189.88.149 80]

It turns out you get these if you don't update, and the official best practices are to `run apt-get update && apt-get install`. In fact, running _any_ apt-get install command without the apt-get update && before it can result in unfortunate caching artifacts -- see "cache busting". (P.S. thanks to Peng on Freenode for helping me, I'm bad at Ubuntu.)

So:
    sed -re \
        's/RUN apt-get ((-y )?(install|build-dep))/RUN apt-get update \&\& apt-get \1/' -i \
        projects/**/Dockerfile

I also manually fixed the cases that already ran apt-get update in their Dockerfile:
    dlplibs/Dockerfile
    grpc/Dockerfile
    libreoffice/Dockerfile
@kcc kcc merged commit 3303866 into google:master May 2, 2017
@kcc
Copy link
Contributor

kcc commented May 2, 2017

Thanks!!

@kcc
Copy link
Contributor

kcc commented May 2, 2017

also: 7def2fc

@kcc
Copy link
Contributor

kcc commented May 2, 2017

and f2dc317

@ssbr
Copy link
Contributor Author

ssbr commented May 2, 2017

Whoops, forgot about the templates and stuff. Thanks for the followups!

tmatth pushed a commit to tmatth/oss-fuzz that referenced this pull request Oct 22, 2018
https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

I ran into this because I was getting errors locally, like:

    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg/libdpkg-perl_1.18.4ubuntu1.1_all.deb  404  Not Found [IP: 91.189.88.149 80]

It turns out you get these if you don't update, and the official best practices are to `run apt-get update && apt-get install`. In fact, running _any_ apt-get install command without the apt-get update && before it can result in unfortunate caching artifacts -- see "cache busting". (P.S. thanks to Peng on Freenode for helping me, I'm bad at Ubuntu.)

So:
    sed -re \
        's/RUN apt-get ((-y )?(install|build-dep))/RUN apt-get update \&\& apt-get \1/' -i \
        projects/**/Dockerfile

I also manually fixed the cases that already ran apt-get update in their Dockerfile:
    dlplibs/Dockerfile
    grpc/Dockerfile
    libreoffice/Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants