Docker Community Forums

Share and learn in the Docker community.

Docker-compose fails to pull updated image from dockerhub

I’m running the following versions of docker/docker-compose on a raspberry pi4
docker version
Client: Docker Engine - Community
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46
Built: Wed Sep 16 17:07:02 2020
OS/Arch: linux/arm
Experimental: false

Server: Docker Engine - Community
Engine:
Version:          19.03.13
API version:      1.40 (minimum version 1.12)
Go version:       go1.13.15
Git commit:       4484c46
Built:            Wed Sep 16 17:00:52 2020
OS/Arch:          linux/arm
Experimental:     false
containerd:
Version:          1.3.7
GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
runc:
Version:          1.0.0-rc10
GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version:          0.18.0
GitCommit:        fec3683

docker-compose version 1.27.4, build unknown

I have a stack defined in a docker-compose file. It has few services, one of them is defined as following

nodered:
    container_name: node-red
    # Build a custom image to add some plug-ins:
    # - https://flows.nodered.org/node/node-red-contrib-amazondash
    build:
        context: ./node-red
    restart: unless-stopped
    # Looks like required to allow pcap to work.
    user: root
    # Pcap should work in promiscuous mode (http://man7.org/linux/man-pages/man7/capabilities.7.html)
    cap_add:
    - NET_ADMIN
    ports:
    - "1880:1880"
    volumes:
    - ./node-red/data:/data
    - /etc/localtime:/etc/localtime:ro
    depends_on:
        - mosquitto

In the ./node-red folder I have Dockerfile which references nodered/node-red:latest image on docker-hub

FROM nodered/node-red:latest

# Elevate user to allow packages installation.
USER root

# Add dependencies for both build time and run time.
RUN apk add libpcap-dev


# Add new plug-ins.
RUN npm install \
    node-red-contrib-amazondash \
    node-red-dashboard \
    node-red-node-suncalc \
    node-red-contrib-influxdb \
    node-red-contrib-telegrambot

# Back to the node-red user, from now on.
USER node-red

Now, when I run the docker-compose pull command, I can see the newer node-red image being pulled, but, even after running the docker-compose build command, the nodered service is still using the old image.

I’ve tried also more aggressive commands like

docker-compose build --force-rm --no-cache --pull nodered

But when I run the nodered service is still using an old version.

Any idea why this might happen?