Skip to content

[V1] containerd makes binaries bigger due to importing std plugin #11202

@pgimalac

Description

@pgimalac

What is the problem you're trying to solve

Importing the plugin standard library package makes binaries significantly bigger, due to disabling some dead code elimination (cmd/link/internal/ld/deadcode.go) and symbol names being longer (cmd/link/internal/ld/lib.go).

github.com/containerd/containerd imports github.com/containerd/containerd/plugin which imports plugin on amd64:

Image

As shown in DataDog/datadog-agent#32538, just removing the import on amd64 reduces the size of one of our binaries from 218MB to 150MB (-31%).

I would like to suggest adding a specific build tag to remove this import. I know using the static_build tag would do the same, but since it is used by many other dependencies I'm worried it would have unexpected consequences...

Describe the solution you'd like

Have a way to use containerd v1 types and functions without having to import the plugin package, and without changing behavior of other dependencies.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions