コード例 #1
0
func setUpDocker(c *check.C) {
	common.InstallSnap(c, "docker")
	dockerVersion := common.GetCurrentVersion(c, "docker")
	dockerService := fmt.Sprintf("docker_docker-daemon_%s.service", dockerVersion)

	err := wait.ForActiveService(c, dockerService)
	c.Assert(err, check.IsNil, check.Commentf("Error waiting for service: %s", err))

	err = wait.ForCommand(c, `(?ms).*docker\.sock\s.*`, "ls", "/run")
	c.Assert(err, check.IsNil, check.Commentf("Expected nil error, got %s", err))

	cli.ExecCommand(c, "docker", "pull", baseContainer)
}
コード例 #2
0
func restartDocker(c *check.C) {
	dockerVersion := common.GetCurrentVersion(c, "docker")
	dockerService := fmt.Sprintf("docker_docker-daemon_%s.service", dockerVersion)

	cli.ExecCommand(c, "sudo", "systemctl", "restart", dockerService)

	// we need to wait until the socket is ready, an active systemctl status is not enough
	err := wait.ForActiveService(c, dockerService)
	c.Assert(err, check.IsNil, check.Commentf("Expected nil error, got %s", err))

	err = wait.ForCommand(c, `(?ms).*docker\.sock\s.*`, "ls", "/run")
	c.Assert(err, check.IsNil, check.Commentf("Expected nil error, got %s", err))
}