Merge pull request #31273 from fabiokung/consistent-ro-view

No container locks on `docker ps`
Upstream-commit: 56ad9bb1b4f7463cf1d6eab8b6f924f46ff2c2fe
Component: engine
This commit is contained in:
Aaron Lehmann
2017-06-23 15:28:55 -07:00
committed by GitHub
32 changed files with 692 additions and 299 deletions
@@ -2684,7 +2684,7 @@ func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
`)
configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
err = ioutil.WriteFile(configPath, config, 600)
c.Assert(ioutil.WriteFile(configPath, config, 600), checker.IsNil)
d.Start(c)
out, err = d.Cmd("inspect", "--type=container", "--format={{ json .Mounts }}", id)
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"regexp"
"strings"
"github.com/docker/docker/api/types"
@@ -50,14 +51,17 @@ func getPausedContainers(t testingT, dockerBinary string) []string {
return strings.Fields(result.Combined())
}
var alreadyExists = regexp.MustCompile(`Error response from daemon: removal of container (\w+) is already in progress`)
func deleteAllContainers(t testingT, dockerBinary string) {
containers := getAllContainers(t, dockerBinary)
if len(containers) > 0 {
result := icmd.RunCommand(dockerBinary, append([]string{"rm", "-fv"}, containers...)...)
if result.Error != nil {
// If the error is "No such container: ..." this means the container doesn't exists anymore,
// we can safely ignore that one.
if strings.Contains(result.Stderr(), "No such container") {
// or if it is "... removal of container ... is already in progress" it will be removed eventually.
// We can safely ignore those.
if strings.Contains(result.Stderr(), "No such container") || alreadyExists.MatchString(result.Stderr()) {
return
}
t.Fatalf("error removing containers %v : %v (%s)", containers, result.Error, result.Combined())