CCCC
CCCC

Reputation: 6461

docker - image not updating after building

After I run docker-compose up -d --build, I run docker images, it shows:

REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
test-tets-test-server_my-web                  latest              2a3f05e387a7        1 minutes ago       2.81GB

But When I run docker run -it 2a3f05e387a7 sh and look for the files, it seems that the files are not updating and still in old version.

Dockerfile

FROM node:lts-alpine

RUN npm install --global sequelize-cli nodemon

WORKDIR /server

COPY package*.json ./

RUN npm install

COPY . . 

EXPOSE 3030

CMD ["npm", "run", "dev"]

docker-compose.yml

version: '2.1'

services:
  test-db:
    image: mysql:5.7
    ...
  test-web:
    environment:
      - NODE_ENV=local
      - PORT=3030
    build: .           
    command: >
      ./wait-for-db-redis.sh test-db npm run dev
    volumes:
      - ./:/server     
    ports:
      - "3030:3030"
    depends_on:
      - test-db

package.json

...
  "scripts": {
    "test": "npm run lint && npm run mocha",
    "lint": "eslint src/. test/. --config .eslintrc.json --fix",
    "dev": "nodemon --legacy-watch src/",
    "start": "node src/",
  },
...

Upvotes: 2

Views: 1150

Answers (1)

Saeed
Saeed

Reputation: 4125

Since docker-compose up -d --build does not recreate, you may still see the old file, or they may be cache.

Run docker-compose up -d --build --force-recreate to force it recreate the image.

Upvotes: 1

Related Questions