5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker 環境別 no cache install

Last updated at Posted at 2020-07-25

docker cache clean clear

基本的には、multi-stage-buildを用いて、build用のimageと成果物のimageを分けることが望ましい。
installされたpackageが多数のディレクトリにまたがっていたり、それが難しいケースはbase imageのパッケージ管理ツールのclean機構をonelinerで書くと良い。

apt

Dockerfile
FROM debian

RUN apt-get update && apt-get install -y \ 
* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

参考: https://docs.docker.jp/engine/articles/dockerfile_best-practice.html#run

npm

Dockerfile
FROM node

RUN npm install -g \
* \
&& npm cache clean --force

参考: https://qiita.com/hikaruna/items/0bc1e97e8d254f4c27e7

yarn

Dockerfile
FROM node

RUN yarn global add \
* \
&& yarn cache clean

参考

yum

TODO

pip

TODO

5
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?