有人可以解释(也许给出解决方法) docker-compose 的以下行为吗?
给定以下文件:
Dockerfile
FROM alpine:3.8
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
入口点.sh
#!/bin/sh
until [ ! -z "$PLOP" ]; do
echo -n 'enter value here: '
read PLOP
done
echo "Good ... PLOP is $PLOP"
exit 1
docker-compose.yml
version: '3.7'
services:
plop:
tty: true
stdin_open: true
image: webofmars/plop:latest
输出如下:
1) ./entrypoint.sh
docker-stdin> ./entrypoint.sh
enter value here:
CASE1
Good ... PLOP is CASE1
这似乎OK
2) docker-stdin> docker run -it webofmars/plop
enter value here: CASE2
Good ... PLOP is CASE2
这似乎OK
3) docker-stdin> docker-compose run plop
enter value here: CASE3
Good ... PLOP is CASE3
这似乎OK
4) docker-stdin> docker-compose up
Recreating docker-stdin_plop_1 ... done
Attaching to docker-stdin_plop_1 (last forever)
这看起来很奇怪并且NOT OK对于我的用例
我错过了什么吗?