Jade
Jade

Reputation: 355

Unable to push docker images to Azure Registry Container using docker-compose file

I want to push the sonarqube image and posgres image available from docker hub into my own registry get the following error: enter image description here

This is my docker compose step within my azure-pipelines.yaml file:

jobs:
  - job: Deploy
    steps:
    - task: DockerCompose@0
      displayName: 'Push services'
      inputs:
        action: 'Push services'
        azureSubscriptionEndpoint: $(mySubscriptionEndpoint)
        azureContainerRegistry: $(myContainerRegistry)
        dockerComposeFile: $(dockerComposeFileSonarQube)

And this is my docker-compose.yaml file:

version: "3.8"
services:
  sonarqube:
    build: .
    image: "sonarqube:8.2-community"
    depends_on:
      - db
    ports:
      - "9000:9000"
    networks:
      - sonarnet
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
      - sonarqube_temp:/opt/sonarqube/temp
  db:
    image: "postgres"
    networks:
      - sonarnet
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

networks:
  sonarnet:
    driver: bridge

volumes:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  sonarqube_temp:
  postgresql:
  postgresql_data:

From the error, I imagine it is trying to build in the repository that I am pushing to, but the images are not there yet, what I want to do is push the images from the docker hub repositories. Is there a way to do this? If I remove the build step from the docker-compose.yaml file, it does nothing.

Upvotes: 2

Views: 434

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222522

Have you tagged the images ?

First you have to tag the docker image,

docker tag docker-hello-world_backend sajee.azurecr.io/development/docker-hello-world_backend:1.0

Then you can push

docker push sajee.azurecr.io/development/docker-hello-world_backend:1.0

Upvotes: 1

Related Questions