#dagger container export not working when using with docker import

1 messages ยท Page 1 of 1 (latest)

quiet burrow
#

Maybe it's the code at night. ๐Ÿ˜‚

I have a code like this:

package main

import (
    "context"
    "fmt"
    "os"

    "dagger.io/dagger"
)

func main() {
    client, err := dagger.Connect(context.Background(), dagger.WithLogOutput(os.Stdout))
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    defer client.Close()

    _, err = client.Container().From("alpine").Export(context.Background(), "hello.tar")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

The intention is I want to export a container that defined from from to an image. And use docker import to import image from tar file to docker like this:

docker import .\hello.tar hello-alpine

And using with docker run -it --rm hello-alpine /bin/sh. Expected to see it can run enter the shell, but it returns error like this:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown.

I'm not sure what I miss. T_T

sinful sluice
#

It should be docker load, yes.

#

You're not the first ๐Ÿ™‚

#

You do an "export", you expect to do the reverse on the other end ("import") ๐Ÿ™‚

quiet burrow
#

I thought that docker import is shorthand syntax of docker load + tag. This change my mind. ๐Ÿ˜‚

silent bough
#

yeah.. docker save and docker export have a confusing API