MCPcopy Create free account
hub / github.com/fsouza/go-dockerclient / stopContainer

Method stopContainer

testing/server.go:718–734  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

716}
717
718func (s *DockerServer) stopContainer(w http.ResponseWriter, r *http.Request) {
719 id := mux.Vars(r)["id"]
720 container, err := s.findContainer(id)
721 if err != nil {
722 http.Error(w, err.Error(), http.StatusNotFound)
723 return
724 }
725 s.cMut.Lock()
726 defer s.cMut.Unlock()
727 if !container.State.Running {
728 http.Error(w, "Container not running", http.StatusBadRequest)
729 return
730 }
731 w.WriteHeader(http.StatusNoContent)
732 container.State.Running = false
733 s.notify(container)
734}
735
736func (s *DockerServer) pauseContainer(w http.ResponseWriter, r *http.Request) {
737 id := mux.Vars(r)["id"]

Callers

nothing calls this directly

Calls 3

findContainerMethod · 0.95
notifyMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected