mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-31 13:24:49 +00:00 
			
		
		
		
	Generated largely from the specified config; small parts taken from `docker image inspect`, such as the command line. Renamed some of the yaml keys to match the OCI spec rather than Docker Compose as we decided they are more readable, no more underscores. Add some extra functionality - tmpfs specification - fully general mount specification - no new privileges can be specified now For nostalgic reasons, using engine-api to talk to the docker cli as we only need an old API version, and it is nice and easy to vendor... Signed-off-by: Justin Cormack <justin.cormack@docker.com>
		
			
				
	
	
		
			27 lines
		
	
	
		
			627 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			627 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package client
 | |
| 
 | |
| import (
 | |
| 	"encoding/json"
 | |
| 
 | |
| 	"golang.org/x/net/context"
 | |
| 
 | |
| 	"github.com/docker/engine-api/types"
 | |
| )
 | |
| 
 | |
| // ContainerWait pauses execution until a container exits.
 | |
| // It returns the API status code as response of its readiness.
 | |
| func (cli *Client) ContainerWait(ctx context.Context, containerID string) (int, error) {
 | |
| 	resp, err := cli.post(ctx, "/containers/"+containerID+"/wait", nil, nil, nil)
 | |
| 	if err != nil {
 | |
| 		return -1, err
 | |
| 	}
 | |
| 	defer ensureReaderClosed(resp)
 | |
| 
 | |
| 	var res types.ContainerWaitResponse
 | |
| 	if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
 | |
| 		return -1, err
 | |
| 	}
 | |
| 
 | |
| 	return res.StatusCode, nil
 | |
| }
 |