How to list locally-stored manifests

Viewed 463

When I do docker manifest create ... this manifest is stored locally and it is not pushed to the registry until I do docker manifest push ... but I'm not sure where it lives in the meantime, before it is pushed.

I know that I can remove the locally-stored manifest with docker manifest rm ... but my goal is to clean up any forgotten manifests that I created, so how can I list all the locally-stored manifests?

I expected docker manifest ls but no such command exists.

1 Answers

Kind of surprised, that this is not documented anywhere. I had to investigate this myself by reading the source code of docker-cli:

  • The docker manifest create command is implemented in command/manifest/create_list.go. It eventually calls manifestStore.Save.

  • The manifestStore is obtained from dockerCli.ManifestStore(), which is implemented in command/cli.go like this:

    func (cli *DockerCli) ManifestStore() manifeststore.Store {
        // TODO: support override default location from config file
        return manifeststore.NewStore(filepath.Join(config.Dir(), "manifests"))
    }
    

So in short, you can list or remove all manifests by listing or removing the contents of ~/.docker/manifests (or more precisely ${DOCKER_CONFIG}/manifests).

This is not very elegant, but there's no better alternative at the moment AFAIK.

Related