Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No Docker config.json in Amazon Linux EC2

So in order to set up the amazon-ecr-credential-helper I need to add some lines to the .docker/config.json file in my EC2. When I try to run the script

  echo "{ \"credHelpers\": { \"acc_id.dkr.ecr.acc_region.amazonaws.com\": \"ecr-login\" } }" > ~/.docker/config.json

I get an error -bash: /root/.docker/config.json: No such file or directory

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Docker is installed, I’m using root user. This is an Amazon Linux EC2. Can someone please tell me what is wrong here? Doesn’t Docker already create the .docker folder? Or is this something I need to do?

Some context: I intend to run this script as part of the EC2 Userdata, but have been facing issues, so trying to debug within the container first.

Any hints in the right direction would be highly appreciated.
Thanks!

>Solution :

"Doesn’t Docker already create the .docker folder?"

No, Docker doesn’t create a .docker folder in every user’s home directory. You need to create that folder yourself.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading