I have a docker container which runs a java program in foreground on startup. The java program listens to input on
stdin. How can I programmatically send text to the java program?
The container is started with
-it, so I can
docker attach <container-name>, type my text, send it with enter and detach using
docker exec <container-name> echo my-text, but this gets echoed to stdout, not the java program. Can I somehow pipe this to the java program?
I also found a similar question in the Docker forums, but the solution uses
screen and I'd rather have a cleaner solution.