How to pull image from private registry running on localhost with docker-compose

  docker, docker-compose, docker-desktop, nexus

I have Docker Desktop running, and inside I got Nexus repository running. I have logged into repository.

I have pushed the image and I’m able to pull it like:

docker pull localhost:8123/node-web-app:mytag

But, how should I configure docker-compose.yml to pull the image from private nexus repo running on localhost? When I run the docker-compose up, image is not pulled but builded.
Currently I have in docker-compose.yml:

services:
  frontapp1:
    build:
      context: .
      dockerfile: Dockerfile
    image: 127.0.0.1:8123/node-web-app:latest
    container_name: nodejs
    restart: unless-stopped
    ports:
      - "49160:8080"

I have also tried with:
image: localhost:8123/node-web-app:latest

Nexus UI is running behind port 8081, I guess I should not use that port?

Source: Docker Questions

LEAVE A COMMENT