Failed to pull private repository

I’m following this tutorial to create a Ci/CD pipeline
Docker-Based Build Pipelines – Continuous Deployment

I managed to push the image to the registry (I’ve tried dockerhub, amazon ECR and quay.io) but when I try to deploy the image in a host I’m getting this error:
(Expected state running but got error: Image [quay.io/xxxx/projectname] failed to pull: Pulling repository quay.io/valeet/deathstar)

I use rancher-compose to fetch the images.

I’ve registered the credential for the registry in the Rancher admin tool.

Any Idea how to solve this?

I believe you need to add the private Docker repository to your environment.
Go to Rancher web UI -> select specific environment -> select menu Infrastructure -> Registries -> click button “Add Registry”.

Just to build on what satrapu said:

There are instructions on how to add the ECR registry here: http://rancher.com/using-amazon-container-registry-service/. Basically:

  1. Add custom repository
  2. Address is your ecr repo: <your_project_id>.dkr.ecr.us-east-1.amazonaws.com/project-name
  3. Username is: AWS
  4. Password is the output of aws ecr get-login | cut -d ' ' -f 6

The other thing I had to do is to setup recurring auth refresh. ObjectPartners has a container for this:

version: '2'
services:
  ecr-refresh:
    image: objectpartners/rancher-ecr-credentials
    environment:
      AWS_REGION: <YOUR_REGION>
      AWS_ACCESS_KEY_ID: <YOUR_KEY>
      AWS_SECRET_ACCESS_KEY: <YOUR_SECRET>
    stdin_open: true
    tty: true
    labels:
      io.rancher.container.agent.role: environment
      io.rancher.container.create_agent: 'true'
      io.rancher.container.pull_image: always