Deployed a Dockerized Rails Application on EC2 instance with AWS ECS service. I am using ecs-cli for deploying rails application which using docker-compose.yml file for deploying containers as services similar to docker-compose mode. For running interactive shell such as rails console for my app, I created one separate service with following definition:
version: '2'
volumes:
app-tmp:
driver: local
app-logs:
driver: local
services:
console:
image: acc-name.dkr.ecr.us-east-1.amazonaws.com/docker_repo:latest
command: bundle exec rails c
hostname: console
mem_limit: 314572800
env_file: ../.prod-env
tty: true
stdin_open: true
ports: []
volumes:
- "app-logs:/home/app/log"
- "app-tmp:/home/app/tmp"
But when I deploy the task with following command:
ecs-cli compose -f docker/docker-compose-console.yml --project-name app-console run console "bundle exec rails c"
The flags tty: true and stdin_open: true are ignored. Due to which the task running console boots up, changes to RUNNING state and then silently closes down with state 0.
Is there any way one can run interactive console session or tailed logs? What approaches are used to achieve similar behavior?
TL;DR: I want behavior similar to docker-compose run app rails c with AWS ECS service.
I also posted this question on Stackoverflow.