我正在尝试在docker容器中运行Symfony 3控制台命令,但无法获得正确的输出。
version: '3.4'
services:
app:
build:
context: .
target: symfony_docker_php
args:
SYMFONY_VERSION: ${SYMFONY_VERSION:-}
STABILITY: ${STABILITY:-stable}
volumes:
# Comment out the next line in production
- ./:/srv/app:rw,cached
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
- /srv/app/var/
- /srv/app/var/cache/
- /srv/app/var/logs/
- /srv/app/var/sessions/
environment:
- SYMFONY_VERSION
nginx:
build:
context: .
target: symfony_docker_nginx
depends_on:
- app
volumes:
# Comment out the next line in production
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
- ./public:/srv/app/public:ro
ports:
- '80:80'
我的控制台命令
docker-compose exec nginx php bin/console
它返回以下响应
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
答案 0 :(得分:1)
从https://docs.docker.com/compose/reference/exec/复制
要禁用此行为,可以使用-T标志禁用伪tty分配。
docker-compose exec -T nginx <command>
或者,将COMPOSE_INTERACTIVE_NO_CLI值设置为1
export COMPOSE_INTERACTIVE_NO_CLI=1
要使php bin /控制台运行,您需要从以下应用容器运行。
docker-compose exec -T app php bin / console