#Docker Save Equivalent?

1 messages · Page 1 of 1 (latest)

light bear
#

Hey guys looking around trying to find an equivalent to docker save? I'm doing asTarball and docker load is failing with an invalid tar header error

subtle lark
#

as-tarball should be the way, so something may be broken 🤔 can you share how you're using asTarball?

light bear
#

literally just AsTarball() at the end of a container

#

the container is arm64 - that's probably the only thing interesting about it

light bear
#

I'll see if I can write up a reproduction I guess

#

I'm loading from docker v20 fiwwi

spare imp
#

Is that docker engine v20?

Its possible that is an issue but i am not able to reproduce. I tried on latest docker engine and on an old version

Client: Docker Engine - Community
 Version:           25.0.3
 API version:       1.41 (downgraded from 1.44)
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Tue Feb  6 21:13:09 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          20.10.24
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.7
  Git commit:       5d6db84
  Built:            Tue Apr  4 18:18:48 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.20
  GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc:
  Version:          1.1.5
  GitCommit:        v1.1.5-0-gf19387a
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

This is my code, are you able to reproduce with this simple example?

package main

import (
    "context"
)

type Tar struct{}

// Build and publish image with annotations
func (m *Tar) Build(
    ctx context.Context,
) *File {
    return dag.Container().
        From("alpine").
            AsTarball()
}
light bear
#

Hey @spare imp - thanks for following up. Here's what happens for me.

code:

var PublishAlpineCommand = &cli.Command{
    Name:  "alpine",
    Usage: "build and publish alpine daemons",
    Action: func(cCtx *cli.Context) error {
        initInfo, err := core.Initialize()
        if err != nil {
            return fmt.Errorf("Failed to initialize repo: %v", err)
        }
        defer initInfo.DaggerClient.Close()
        // 4 hours runtime.
        runCtx, cancelFunc := context.WithDeadline(context.Background(), time.Now().Add(360*time.Minute))
        defer cancelFunc()

        initInfo.DaggerClient.Container(dagger.ContainerOpts{Platform: "linux/arm64"}).
            From("alpine").
            AsTarball(dagger.ContainerAsTarballOpts{MediaTypes: dagger.Dockermediatypes}).Export(runCtx, "alpine.tar")

        return nil
    },
}