ahmetb / go-dexec

It's like Go os/exec package but for Docker. What if you could exec programs remotely with the same interface as os/exec?
https://godoc.org/github.com/ahmetalpbalkan/go-dexec
Apache License 2.0
430 stars 38 forks source link

application is blocking forever #14

Open F1zm0n opened 1 month ago

F1zm0n commented 1 month ago
func main() {
    cl, _ := docker.NewClientFromEnv()
    d := dexec.Docker{Client: cl}

    m, _ := dexec.ByCreatingContainer(docker.CreateContainerOptions{
        Config: &docker.Config{Image: "node"}})

    cmd := d.Command(m, "echo", `I am running inside a container!`)
    b, err := cmd.Output()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%s", b)
}

i know its been a long time but when i execute this code my application is blocking forever even tho container is stopped

ahmetb commented 1 month ago

It probably has something to do with Docker Remote API or the docker daemon. This library is pretty dumb, so highly doubt that's the issue.

F1zm0n commented 1 month ago

It probably has something to do with Docker Remote API or the docker daemon. This library is pretty dumb, so highly doubt that's the issue.

its def something has to do with ByCreatingContainer but anyways appreciate the library

ahmetb commented 1 month ago

What sort of debugging you've done so far to make you say "its def" this library?

F1zm0n commented 1 month ago

What sort of debugging you've done so far to make you say "its def" this library?

it works good without this method function, i've tried several things, anyways i just had to move to official docker client, to create type of stuff that you created but from scratch, needed it for pipeline executions, because docker client just is very clunky for me, ig i had to stick with it for rn