简体   繁体   中英

bash script to start a docker container running a mono console application cannot send commands in interactive mode

Assuming the container name is "dave" and the mono application is called "dummy_app"

dockerfile for the container:

FROM mono:latest
ADD . /src
EXPOSE 8081
RUN xbuild /src/dummy_app.sln
CMD [ "mono", "/src/dummy_app/bin/Debug/dummy_app.exe" ]

script:

echo "Start"
sudo docker start -i dave
echo "debug true"

The script stalls at the line "sudo docker start -i dave" because I assume it waits to detach from the stdin of the container in order to continue. Hence line "debug true" does not execute.

In the ssh session I can see the container starting up launching the mono application and I can type commands in and get responses as with a normal console application but I can't figure out how to send commands from the script into the newly attached container that would achieve the same thing.

From here

Start one or more containers

  -a, --attach=false         Attach STDOUT/STDERR and forward signals
  --help=false               Print usage
  -i, --interactive=false    Attach container's STDIN

You need to remove the -i flag.

In general for all the docker commands you can use the --help flag to check the options you have and the default values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM