docker-credential-ecr-login command not found

In this troubleshooting guide we learn how to fix docker-credential-ecr-login command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

docker-credential-ecr-login: command not found

or when using sudo you get the following error message

sudo: docker-credential-ecr-login: command not found

Solutions to docker-credential-ecr-login: command not found

How To Fix docker-credential-ecr-login: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu docker-credential-ecr-login is provided by amazon-ecr-credential-helper package.

amazon-ecr-credential-helper is:

A Docker credential helper to automatically manage credentials for Amazon ECR.

Once configured, the Amazon ECR Credential Helper lets you “docker pull” and “docker push” container images from Amazon ECR without running “docker login”.

Amazon ECR is a container registry and requires authentication for pushing and pulling images. You can use the AWS CLI or the AWS SDK to obtain a time-limited authentication token. This credential helper automatically manages obtaining and refreshing authentication tokens when using the Docker CLI.

For more information about Amazon ECR and how to use it, see the documentation at https://docs.aws.amazon.com/AmazonECR/latest/userguide/.

To fix this problem, we can install more using the command below.

sudo apt-get -y install amazon-ecr-credential-helper

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install amazon-ecr-credential-helper.

sudo apt -y install amazon-ecr-credential-helper

Or if you have aptitude installed you can use the following command.

sudo aptitude install amazon-ecr-credential-helper

Summary

In this tutorial we learn how to fix docker-credential-ecr-login command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.