IMB
IMB

Reputation: 15909

Temporarily cache RUN apt-get update && apt-get install in Dockerfile

Is it possible to temporarily cache this line RUN apt-get update && apt-get install -y in Dockerfile?

Reason is when troubleshooting Dockerfile, I rebuild the image several times and this line has the longest wait time.

Upvotes: 2

Views: 801

Answers (1)

Artem Pakhomov
Artem Pakhomov

Reputation: 71

Yes, it possible.

Create docker image from your docker file. Separate file to 2 Dockerfile's, first with FROM and RUN apt-get update && apt-get install -y, second with other instructions

cd /dir/with/Dockerfile

docker image build -t my-fast-docker .

After build use image in second Dockerfile

FROM my-fast-docker:latest

Upvotes: 4

Related Questions