Docker没有从缓存中加载节点映像

时间:2018-07-24 19:41:32

标签: node.js docker docker-compose dockerfile

我在本地环境中使用docker-compose进行开发。我有4个Docker容器,其中3个基于docker-node

运行docker-compose up --build时,我看到大多数构建步骤都是从缓存加载的,因此它们通常运行得非常快。但是,从几天前开始,我注意到它们开始花费很长时间(共约10分钟)来构建,即使什么都没有改变。

我还注意到,所有构建步骤似乎都是从缓存中加载的,除了第一个:FROM node:8。确实,打印第一步总是需要最长的时间。这是完整的输出:

Building mongo-seed
Step 1/10 : FROM node:8
 ---> d575940ea42b
Step 2/10 : ENV NODE_ENV=development
 ---> Using cache
 ---> 64584d7c28d1
Step 3/10 : WORKDIR /seeder
 ---> Using cache
 ---> 2481554b20cc
Step 4/10 : COPY ./server/app/models ./app/models
 ---> Using cache
 ---> ad6c76419ffd
Step 5/10 : COPY ./server/config ./config
 ---> Using cache
 ---> 379dd9e19e67
Step 6/10 : COPY ./server/util ./util
 ---> Using cache
 ---> 1e6db5498a1a
Step 7/10 : COPY ./server/seed ./seed
 ---> Using cache
 ---> 659f531ef78d
Step 8/10 : COPY ./server/package.json ./package.json
 ---> Using cache
 ---> 4eb54f2548b9
Step 9/10 : RUN npm i mongoose
 ---> Using cache
 ---> c34967921c69
Step 10/10 : CMD npm run seed
 ---> Using cache
 ---> 0274c6635c1d
Successfully built 0274c6635c1d
Successfully tagged javorosas_mongo-seed:latest
Building server
^[Step 1/17 : FROM node:8
 ---> d575940ea42b
Step 2/17 : RUN apt-get update
 ---> Using cache
 ---> 4cb3797b4737
Step 3/17 : RUN apt-get install -y graphicsmagick
 ---> Using cache
 ---> a33dcf53e585
Step 4/17 : RUN npm i -g webpack node-gyp nodemon
 ---> Using cache
 ---> c961ca565c54
Step 5/17 : ENV NODE_ENV=development
 ---> Using cache
 ---> c63d1a245873
Step 6/17 : WORKDIR /server
 ---> Using cache
 ---> 7ac6181902ca
Step 7/17 : COPY ./server/package.json .
 ---> Using cache
 ---> ebba732f0210
Step 8/17 : COPY ./common ../common
 ---> Using cache
 ---> 47a9e631cc57
Step 9/17 : RUN npm install --quiet && npm cache clean -f
 ---> Using cache
 ---> 8d57a963d1ac
Step 10/17 : COPY ./server/constants ./constants
 ---> Using cache
 ---> a6a8884a1343
Step 11/17 : COPY ./server/util ./util
 ---> Using cache
 ---> dfd9de1db59e
Step 12/17 : COPY ./server/webpack.ssr.js .
 ---> Using cache
 ---> 547282293bc6
Step 13/17 : COPY ./server/src ./src
 ---> Using cache
 ---> e7821c59d012
Step 14/17 : RUN npm run build
 ---> Using cache
 ---> 184527650563
Step 15/17 : COPY . .
 ---> 8be425af57c7
Step 16/17 : EXPOSE 2018
 ---> Running in c662570856a5
Removing intermediate container c662570856a5
 ---> 1eb434d7e0ea
Step 17/17 : CMD npm run start:dev
 ---> Running in 613c7064436e
Removing intermediate container 613c7064436e
 ---> f37d511ffc78
Successfully built f37d511ffc78
Successfully tagged javorosas_server:latest
Building client
Step 1/10 : FROM node:8
 ---> d575940ea42b
Step 2/10 : RUN npm i -g webpack
 ---> Using cache
 ---> b8428ab7c232
Step 3/10 : ENV NODE_ENV=development
 ---> Using cache
 ---> bbfbbb480a46
Step 4/10 : WORKDIR /client
 ---> Using cache
 ---> 2203bdaa2cea
Step 5/10 : COPY ./client/package.json .
 ---> Using cache
 ---> fe5ead356992
Step 6/10 : COPY ./common ../common
 ---> Using cache
 ---> db9c274937cc
Step 7/10 : RUN npm install --quiet && npm cache clean -f
 ---> Using cache
 ---> 16be06b426b3
Step 8/10 : COPY . .
 ---> c96343b67244
Step 9/10 : EXPOSE 2017
 ---> Running in 7460e5f1d0c6
Removing intermediate container 7460e5f1d0c6
 ---> 8436f916f585
Step 10/10 : CMD npm run start
 ---> Running in fbcf8af08cbf
Removing intermediate container fbcf8af08cbf
 ---> 47958626245f
Successfully built 47958626245f
Successfully tagged javorosas_client:latest
javorosas_mongo_1 is up-to-date
Starting javorosas_mongo-seed_1 ... done
Recreating javorosas_server_1   ... done
Recreating javorosas_client_1   ... done
Attaching to javorosas_mongo_1, javorosas_mongo-seed_1, 
javorosas_server_1, javorosas_client_1

关于为什么它可能开始变慢的任何想法?

0 个答案:

没有答案