The JFrog documentation is lacking on how to do this in a proper way, expecting to use the normal procedures for logging into docker and not in an automated way. This gets even worse if you try and configure your task to authenticate to a private registry - which does not seem to be possible.
The solution is to adjust your user-data, preferably storing your config and key in Secrets Manager.
Putting the config into Secret Manager:
aws secretsmanager update-secret --secret-id artifactory --region us-west-1 --secret-string '{"https://companyname-repo-virtual.jfrog.io": {"auth": "AUTHKEY_FROM_SETMEUP","email": "EMAIL_FROM_SETMEUP"}}'
Adjusting your User Data script:
# Install awslogs and the jq JSON parser
yum install -y awslogs jq aws-cli
# ECS config
echo ECS_CLUSTER='${ECS_CLUSTER_NAME}' >> /etc/ecs/ecs.config
echo ECS_ENGINE_AUTH_TYPE=dockercfg
echo ECS_ENGINE_AUTH_DATA=`aws secretsmanager get-secret-value --secret-id artifactory --query SecretString --output text --region us-west-1` >> /etc/ecs/ecs.config
Which would evaluate to:
# cat /etc/ecs/ecs.config
ECS_CLUSTER=clustername
ECS_ENGINE_AUTH_TYPE=dockercfg
ECS_ENGINE_AUTH_DATA={"https://companyname-repo-virtual.jfrog.io": {"auth": "AUTHKEY_FROM_SETMEUP","email": "EMAIL_FROM_SETMEUP"}}
Unfortunately this did not work for me.. I am using an ECS optimized AMI and passing the auth value both in a user-data format and also tested it by adding it to /etc/ecs/ecs.config manually. When running a docker pull it can't pull the image due to authorization but when I execute a docker login and put in the credentials its able to pull the image.