diff --git a/client_test.go b/client_test.go index 84a33d932485..2b6b89fd5044 100644 --- a/client_test.go +++ b/client_test.go @@ -66,6 +66,7 @@ func TestMain(m *testing.M) { err := ctrd.start("containerd", address, []string{ "--root", defaultRoot, + "--state", defaultState, "--log-level", "debug", }, buf, buf) if err != nil { diff --git a/client_unix_test.go b/client_unix_test.go index 2eb0a657b266..27fe7fab12f7 100644 --- a/client_unix_test.go +++ b/client_unix_test.go @@ -8,6 +8,7 @@ import ( const ( defaultRoot = "/var/lib/containerd-test" + defaultState = "/run/containerd-test" defaultAddress = "/run/containerd-test/containerd.sock" ) diff --git a/client_windows_test.go b/client_windows_test.go index e1073ca6017d..115d71497456 100644 --- a/client_windows_test.go +++ b/client_windows_test.go @@ -17,7 +17,8 @@ const ( var ( dockerLayerFolders []string - defaultRoot = filepath.Join(os.Getenv("programfiles"), "containerd", "root-test") + defaultRoot = filepath.Join(os.Getenv("programfiles"), "containerd", "root-test") + defaultState = filepath.Join(os.Getenv("programfiles"), "containerd", "state-test") ) func platformTestSetup(client *Client) error { diff --git a/cmd/containerd/main.go b/cmd/containerd/main.go index dc724732af7a..f919d19be880 100644 --- a/cmd/containerd/main.go +++ b/cmd/containerd/main.go @@ -66,6 +66,10 @@ func main() { Name: "root", Usage: "containerd root directory", }, + cli.StringFlag{ + Name: "state", + Usage: "containerd state directory", + }, } app.Commands = []cli.Command{ configCommand, @@ -156,6 +160,10 @@ func applyFlags(context *cli.Context, config *server.Config) error { name: "root", d: &config.Root, }, + { + name: "state", + d: &config.State, + }, { name: "address", d: &config.GRPC.Address,