Reputation: 8902
That's what I would do in the command line:
$ docker run -i imagename mycommand
Should I just use Runtime.getRuntime().exe()
? Should I use one of the available Java APIs?
From what I've seen, the APIs would help me to pull and push images, but all I want is to run a particular command on a particular public image, and I don't seem to find an easy way to do that with the APIs.
I'm attaching the actual command I'd be executing, just in case:
$ docker run --rm -p 8080:8080 -i owasp/zap2docker-stable zap.sh -daemon -port 8080
Upvotes: 5
Views: 3745
Reputation: 45333
You should think to use java api to manage docker images/container.
You can start with any of them
Java docker-java https://github.com/docker-java/docker-java Active
Java docker-client https://github.com/spotify/docker-client Active
Refer:
Docker Remote API client libraries
Upvotes: 1