我在 docker-compose (1.7 build 0d7bf73
, 撰写文件格式版本 1) 可以从命令行 (docker 1.10.3) 正常工作:
docker run --rm --entrypoint="/bin/bash" node:4 -c "node gridd.js -t | ./node_modules/bunyan/bin/bunyan"
我的 docker 组成:
grid:
image: node:4-slim
entrypoint: /bin/bash
command: -c "node gridd.js -t | ./node_modules/bunyan/bin/bunyan"
使用这个 docker-compose 文件会导致
marcel@client ~/grid $ docker-compose -f ../docker-compose-test.yml -p test up
Removing test_grid_1
Recreating 4e0104efc149_4e0104efc149_4e0104efc149_test_grid_1
ERROR: for grid Container command not found or does not exist.
Attaching to
我也尝试使用 exec 方法,docker-compose 命令作为列表,结果相同
最佳答案
好的,这一定是 docker-compose 中的一个错误。一旦我将 docker-compose.yml 文件移动到当前目录并且不使用 -f 标志指定它,一切正常:)
关于pipe - docker-compose 在命令中使用管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36689217/