diff --git a/Dockerfile b/Dockerfile index cfa337a427..0741ff75fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -537,7 +537,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \ pkg-config \ dpkg-dev \ libapparmor-dev \ - libbtrfs-dev \ libdevmapper-dev \ libseccomp-dev \ libsecret-1-dev \ @@ -556,7 +555,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \ xx-apt-get install --no-install-recommends -y \ gcc \ libapparmor-dev \ - libbtrfs-dev \ libc6-dev \ libdevmapper-dev \ libseccomp-dev \ diff --git a/Dockerfile.e2e b/Dockerfile.e2e index f31ad19f07..9bd676c5fa 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -4,7 +4,6 @@ FROM golang:${GO_VERSION}-alpine AS base ENV GO111MODULE=off RUN apk --no-cache add \ bash \ - btrfs-progs-dev \ build-base \ curl \ lvm2-dev \ diff --git a/Dockerfile.simple b/Dockerfile.simple index 14b831cea1..cfa893e39d 100644 --- a/Dockerfile.simple +++ b/Dockerfile.simple @@ -24,10 +24,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ cmake \ - gcc \ git \ libapparmor-dev \ - libbtrfs-dev \ libdevmapper-dev \ libseccomp-dev \ ca-certificates \ diff --git a/daemon/graphdriver/aufs/aufs.go b/daemon/graphdriver/aufs/aufs.go index c13634ae13..a91bd89ef7 100644 --- a/daemon/graphdriver/aufs/aufs.go +++ b/daemon/graphdriver/aufs/aufs.go @@ -32,6 +32,7 @@ import ( "os/exec" "path" "path/filepath" + "strconv" "strings" "sync" @@ -209,8 +210,8 @@ func (a *Driver) Status() [][2]string { return [][2]string{ {"Root Dir", a.rootPath()}, {"Backing Filesystem", backingFs}, - {"Dirs", fmt.Sprintf("%d", len(ids))}, - {"Dirperm1 Supported", fmt.Sprintf("%v", useDirperm())}, + {"Dirs", strconv.Itoa(len(ids))}, + {"Dirperm1 Supported", strconv.FormatBool(useDirperm())}, } } diff --git a/daemon/graphdriver/aufs/aufs_test.go b/daemon/graphdriver/aufs/aufs_test.go index 377c050e29..e1bef661d7 100644 --- a/daemon/graphdriver/aufs/aufs_test.go +++ b/daemon/graphdriver/aufs/aufs_test.go @@ -10,6 +10,7 @@ import ( "os" "path" "path/filepath" + "strconv" "sync" "testing" @@ -659,8 +660,8 @@ func testMountMoreThan42Layers(t *testing.T, mountPath string) { for i := 1; i < 127; i++ { expected++ var ( - parent = fmt.Sprintf("%d", i-1) - current = fmt.Sprintf("%d", i) + parent = strconv.Itoa(i - 1) + current = strconv.Itoa(i) ) if parent == "0" { diff --git a/daemon/graphdriver/btrfs/btrfs.go b/daemon/graphdriver/btrfs/btrfs.go index 4158470a9d..7f82594b4e 100644 --- a/daemon/graphdriver/btrfs/btrfs.go +++ b/daemon/graphdriver/btrfs/btrfs.go @@ -5,12 +5,17 @@ package btrfs // import "github.com/docker/docker/daemon/graphdriver/btrfs" /* #include +#include #include -// keep struct field name compatible with btrfs-progs < 6.1. -#define max_referenced max_rfer -#include -#include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) + #error "Headers from kernel >= 4.12 are required to build with Btrfs support." + #error "HINT: Set 'DOCKER_BUILDTAGS=exclude_graphdriver_btrfs' to build without Btrfs." +#endif + +#include +#include static void set_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct, const char* value) { snprintf(btrfs_struct->name, BTRFS_SUBVOL_NAME_MAX, "%s", value); @@ -150,18 +155,11 @@ func (d *Driver) String() string { return "btrfs" } -// Status returns current driver information in a two dimensional string array. -// Output contains "Build Version" and "Library Version" of the btrfs libraries used. -// Version information can be used to check compatibility with your kernel. +// Status returns the status of the driver. func (d *Driver) Status() [][2]string { - status := [][2]string{} - if bv := btrfsBuildVersion(); bv != "-" { - status = append(status, [2]string{"Build Version", bv}) + return [][2]string{ + {"Btrfs", ""}, } - if lv := btrfsLibVersion(); lv != -1 { - status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)}) - } - return status } // GetMetadata returns empty metadata for this driver. @@ -241,7 +239,7 @@ func subvolSnapshot(src, dest, name string) error { var cs = C.CString(name) C.set_name_btrfs_ioctl_vol_args_v2(&args, cs) - C.free(unsafe.Pointer(cs)) + free(cs) _, _, errno := unix.Syscall(unix.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))) diff --git a/daemon/graphdriver/btrfs/version.go b/daemon/graphdriver/btrfs/version.go deleted file mode 100644 index 635e976813..0000000000 --- a/daemon/graphdriver/btrfs/version.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build linux -// +build linux - -package btrfs // import "github.com/docker/docker/daemon/graphdriver/btrfs" - -/* -#include - -// around version 3.16, they did not define lib version yet -#ifndef BTRFS_LIB_VERSION -#define BTRFS_LIB_VERSION -1 -#endif - -// upstream had removed it, but now it will be coming back -#ifndef BTRFS_BUILD_VERSION -#define BTRFS_BUILD_VERSION "-" -#endif -*/ -import "C" - -func btrfsBuildVersion() string { - return string(C.BTRFS_BUILD_VERSION) -} - -func btrfsLibVersion() int { - return int(C.BTRFS_LIB_VERSION) -} diff --git a/daemon/graphdriver/btrfs/version_test.go b/daemon/graphdriver/btrfs/version_test.go deleted file mode 100644 index 0f8652f0de..0000000000 --- a/daemon/graphdriver/btrfs/version_test.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build linux -// +build linux - -package btrfs // import "github.com/docker/docker/daemon/graphdriver/btrfs" - -import ( - "testing" -) - -func TestLibVersion(t *testing.T) { - if btrfsLibVersion() <= 0 { - t.Error("expected output from btrfs lib version > 0") - } -} diff --git a/daemon/graphdriver/zfs/zfs.go b/daemon/graphdriver/zfs/zfs.go index 9ce9fc837a..a39a5474f6 100644 --- a/daemon/graphdriver/zfs/zfs.go +++ b/daemon/graphdriver/zfs/zfs.go @@ -232,7 +232,7 @@ func (d *Driver) GetMetadata(id string) (map[string]string, error) { } func (d *Driver) cloneFilesystem(name, parentName string) error { - snapshotName := fmt.Sprintf("%d", time.Now().Nanosecond()) + snapshotName := strconv.Itoa(time.Now().Nanosecond()) parentDataset := zfs.Dataset{Name: parentName} snapshot, err := parentDataset.Snapshot(snapshotName /*recursive */, false) if err != nil { diff --git a/project/PACKAGERS.md b/project/PACKAGERS.md index 62b7ed50d3..5b569f75fd 100644 --- a/project/PACKAGERS.md +++ b/project/PACKAGERS.md @@ -139,7 +139,7 @@ by having support for them in the kernel or userspace. A few examples include: * AUFS graph driver (requires AUFS patches/support enabled in the kernel, and at least the "auplink" utility from aufs-tools) -* BTRFS graph driver (requires BTRFS support enabled in the kernel) +* BTRFS graph driver (requires suitable kernel headers: `linux/btrfs.h` and `linux/btrfs_tree.h`, present in 4.12+; and BTRFS support enabled in the kernel) * ZFS graph driver (requires userspace zfs-utils and a corresponding kernel module) * Libseccomp to allow running seccomp profiles with containers