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 but when I try to deploy the image in a host I’m getting this error:
(Expected state running but got error: Image [] failed to pull: Pulling repository

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: Basically:

  1. Add custom repository
  2. Address is your ecr repo: <your_project_id>
  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'
    image: objectpartners/rancher-ecr-credentials
    stdin_open: true
    tty: true
      io.rancher.container.agent.role: environment
      io.rancher.container.create_agent: 'true'
      io.rancher.container.pull_image: always