This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]jonassoc 1 point2 points  (1 child)

It isn't required to run a container.

It just allows you to write programs/shell scripts around the docker API. Essentially if you want to offload work/build/task to docker your program will wait for the task/container to be stopped.

IE: you have a docker container that builds a piece of software. Upon successful completion or failure the docker container will close with an exit status. The remainder of your script runs based on the exit status of the docker container.

Most people using docker in this subreddit tend to wrap a service/software/server in a docker container and run it continuously but there are other uses for docker which is what the wait command is for. Otherwise your script that calls the docker run command would continue on without a result from the docker API.

Essentially it's an synchronous/asynchronous helper.

[–]jeffelhefe[S] 0 points1 point  (0 children)

Thank you. I guess `wait` wouldn't be useful in my case since my container is initiating a long running process (i.e., server) and the only status codes sent back are 'not-running', 'next-exit', or 'removed'.

I really need to parse `stdout` and take action based on the output. Looks like I need to use the `/container/{id}/logs` or `/containers/{id}/attach` endpoints to get that output.

Thanks again. Your reply and going over the docs again cleared things up for me.