DEV Community

Deploy Rails in Amazon ECS: Part 2 - Push an image to ECR

Raphael Jambalos on August 08, 2019

This is the second part of the Deploy Rails in Amazon ECS post. It's part of a broader series called More than 'hello world' in Docker. The series...
Collapse
 
kavitajadhav profile image
Kavita Jadhav

Thank you Raphael for such detailed tutorial.

I face one issue at point (5.3). Below command didn't work for me.
*aws ecr get-login-password | docker login --username AWS --password-stdin *

To make it work I had to provide registry url in the end of docker login command

Collapse
 
sunpochin profile image
Sun Pochin • Edited

for example, on my terminal I have to enter:

aws ecr get-login-password | docker login --username AWS --password-stdin 789819000571.dkr.ecr.ap-southeast-1.amazonaws.com/sample-docker-rails-app:v1.0.0
Enter fullscreen mode Exit fullscreen mode

readers you need to replace

789819000571.dkr.ecr.ap-southeast-1.amazonaws.com/sample-docker-rails-app:v1.0.0
Enter fullscreen mode Exit fullscreen mode

with your own repository URI created from section (3.2).

and the terminal will return:

Login Succeeded
Enter fullscreen mode Exit fullscreen mode
Collapse
 
raphael_jambalos profile image
Raphael Jambalos

Hi Kavita, thank you for taking the time to read the article. I hope it was helpful. I'm so sorry I wasn't able to get back to you sooner. Can you give me a sample of the docker login command (redact the url if you have to)? This is so I can apply the relevant changes to the article

Collapse
 
cataherrera profile image
Catalina Herrera • Edited
Collapse
 
elbartostrikesagain profile image
Calvin • Edited

There are issues with the base image version and the gem versions. I would confirm docker-compose build works first. I update the image to the most recent Ruby 2.5.x and updated Bundler to the last version to support this Ruby version (2.3.26), and updated Rails to 5.2.8.1.

Collapse
 
rpascar1 profile image
Rpascar1

in the aws cli setup what would the output be? default is json but there is also yaml text and table does this not matter

Collapse
 
richessler profile image
Richard Hessler

it doesn't really matter, whatever your preference is.

Collapse
 
rpascar1 profile image
Rpascar1

What would cause your preference of one over the other?

Collapse
 
richessler profile image
Richard Hessler

One thing to note is that with AWS CLI Version 2 the aws ecr get-login command is replaced with

aws ecr get-login-password | docker login --username AWS --password-stdin

Collapse
 
raphael_jambalos profile image
Raphael Jambalos

Thanks for this Richard, I have edited the article to reflect this. Have a good one! :D

Collapse
 
abigoroth profile image
Ahmad Ya'kob Ubaidullah

Hi Raph,
Please share about your shared_dir Would love to learn how to set it up on fargate.

Collapse
 
jisuanjixue profile image
wangxiaobo

thank you , i will learn how to deplay a ruby on rails application production to ECS, i am in china ,so ,i want to use aliyun ecs