Ruby on rails 在Docker容器上设置Rails控制台不接受任何输入
我试图在停靠的容器中设置Rails控制台。整个应用程序有多个组件,我使用Ruby on rails 在Docker容器上设置Rails控制台不接受任何输入,ruby-on-rails,docker,docker-compose,Ruby On Rails,Docker,Docker Compose,我试图在停靠的容器中设置Rails控制台。整个应用程序有多个组件,我使用docker compose设置了编排。这是我的docker compose.yml文件中的相关服务 app: image: <image_name> # mount the current directory (on the host) to /usr/src/app on the container, any changes in either would be reflected in bo
docker compose
设置了编排。这是我的docker compose.yml
文件中的相关服务
app:
image: <image_name>
# mount the current directory (on the host) to /usr/src/app on the container, any changes in either would be reflected in both the host and the container
tty: true
volumes:
- .:/usr/src/app
# expose application on localhost:36081
ports:
- "36081:36081"
# application restarts if stops for any reason - required for the container to restart when the application fails to start due to the database containers not being ready
restart: always
depends_on:
- other-db
# the environment variables are used in docker/config/env_config.rb to connect to different database containers
container_name: application
environment:
- CONSOLE=$CONSOLE
当我跑的时候
export CONSOLE=Y
docker-compose -f docker-compose.yml up -d && docker attach application
控制台启动,我看到
>
,但我无法输入它。我哪里出错了?尝试使用-I
模式启动容器
-i、 --交互式附加容器的STDIN
差不多
docker-compose-f docker-compose.yml up-i&&docker-attach应用程序
您也可以根据需要混合
-d
和-i
。在post的帮助下,我发现我在docker compose.yml
中缺少了标准打开:true
。添加它就像一件轻而易举的事。谢谢你,不幸的是,-i
是一个Docker选项,在Docker compose
的选项列表中不可用。我在docker compose(用于交互式)中搜索了相应的选项,这就是我找到的。谢谢你的指导:)很高兴听到你找到了相应的选择。
export CONSOLE=Y
docker-compose -f docker-compose.yml up -d && docker attach application