I'm trying to call docker commands via remote api.
Docker remote api does not seem to have 'Detached mode' option. http://docs.docker.io/en/latest/commandline/command/run/
I could use this app in the bash, and I would like to use this via remote api. https://github.com/grigio/docker-stringer
Docker provides an API for interacting with the Docker daemon (called the Docker Engine API), as well as SDKs for Go and Python. The SDKs allow you to build and scale Docker apps and solutions quickly and easily. If Go or Python don't work for you, you can use the Docker Engine API directly.
The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start .
Indeed, the remote API does not have a 'detach' mode as the 'attach' mode is an extra endpoint.
If you want to run in detach mode with the remote API, simply create and start your container without attaching to it.
If the container still shuts down immediately, use docker logs <container id>
to check for errors. The problem might have nothing to do with detach
.
It's important to understand the "docker run" command encapsulates a series of commands from an API perspective:
While "docker run -d" is the same thing as above but without the "attach" step.
Therefore, you need to create and then start your container when using the remote API.
If the container still shuts down immediately, use docker logs <container id>
to check for errors. The problem might have nothing to do with detach
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With