Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker images are not updated

I want to build an image and run a container, but after some changes in code I rebuild image and run container using this command docker-compose up --build. But in Docker Desktop in the list of images I see Created about 6 hours ago. But I did it 2 minutes ago. I regularly delete images in docker desktop before rebuilding, but I see that behavior is not changing. The only way out is to completely reinstall docker desktop application after 3-5 rebuilt images, but it's insane! What's the problem? Is it some cache? This is my docker-compose

    version: '3'
services:
  attachment-loader-prim:
    container_name: attachment-loader
    build:
      context: ""
    restart: always
    image: attachment-loader:latest
    environment:
      SPRING_PROFILES_ACTIVE: "prim"
      LOGGING_LEVEL_ORG_HIBERNATE_SQL: DEBUG
      LOGGING_LEVEL_ORG_HIBERNATE_TYPE_DESCRIPTOR_SQL_BASICBINDER: TRACE
    networks:
      - loader-network
    ports:
      - 8005:8005
      - 8085:8085
      
  attachment-loader-sec:
    container_name: attachment-loader-sec
    build:
      context: ""
    restart: always
    image: attachment-loader:latest
    environment:
      SPRING_PROFILES_ACTIVE: "sec"
      LOGGING_LEVEL_ORG_HIBERNATE_SQL: DEBUG
      LOGGING_LEVEL_ORG_HIBERNATE_TYPE_DESCRIPTOR_SQL_BASICBINDER: TRACE
    networks:
      - loader-network
    ports:
      - 8006:8005
      - 8086:8086

networks:
  loader-network:
    attachable: true

This is my dockerfile

    FROM adoptopenjdk/openjdk11:alpine-jre
VOLUME /tmp
ARG TZ='Europe/Berlin'

RUN sed -i 's/dl-cdn.alpinelinux.org/uk.alpinelinux.org/' /etc/apk/repositories
RUN apk upgrade --update \
    && apk add -U tzdata curl jq \
    && cp /usr/share/zoneinfo/${TZ} /etc/localtime \
    && apk del tzdata \
    && rm -rf \
    /var/cache/apk/*
RUN echo ${TZ} > /etc/timezone

ARG DEPENDENCY=build/dependency
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8005","-cp","app:app/lib/*","com.path.to.your.Application.kt"]
like image 519
Vladislav Ashikhin Avatar asked Feb 01 '26 10:02

Vladislav Ashikhin


1 Answers

After docker-compose build --no-cache To make sure it restarts with the most updated image I use:

docker-compose up -d <service> --force-recreate

like image 92
hamilton.lima Avatar answered Feb 04 '26 00:02

hamilton.lima



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!