简体   繁体   中英

How to easily access docker container when using AWS ECS?

I'm testing a solution of hosting an Ruby on Rails application in Elastic Container Service(ECS). I made the setup without Fargate and have my application running.

The thing is, whenever I have to enter the rails console, it is necessary to ssh one of the cluster instances, run a docker ps to list the containers, copy the container ID and use it in the docker exec -it <container_id> rails c

Do anyone know of a way to make it easier? Something like accessing the container without the need to query the container id or any other shortcut? Would Fargate help in this issue?

You can name your container in task definition and use that name to 'exec'. You wont need container-id in this case. Assuming you have only one container running ie no scaling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM