libcompose
libcompose copied to clipboard
APIProject.Run fails with "inappropriate ioctl for device" error
I'm trying to run libcompose to start some Docker containers in some Go integration tests.
Here's the TestMain function that uses libcompose to set up and tear down the containers:
func TestMain(m *testing.M) {
project, err := docker.NewProject(&ctx.Context{
Context: project.Context{
ComposeFiles: []string{"docker-compose.yml"},
ProjectName: "ts2kusersvc",
},
}, nil)
if err != nil {
log.Fatal(err)
}
err = project.Up(context.Background(), options.Up{})
if err != nil {
log.Fatal(err)
}
// Without this blog, the code runs successfully
var code int
code, err = project.Run(context.Background(), "ts2kusersvc",
[]string{"-h"},
options.Run{},
)
// End problematic code block
if err != nil {
log.Fatal(err)
}
code = m.Run()
// Tear down Docker containers
err = project.Down(context.Background(), options.Down{})
if err != nil {
log.Fatal(err)
}
os.Exit(code)
}
The call to Run() in the above code fails with an "inappropriate ioctl for device" error, which I believe trickles up from Container.Run when calling term.SetRawTerminal.
I'm able to successfully execute the equivalent to my call to APIProject.Run via docker-compose run ....
can you specify what version your docker daemon is running?
$ dockerd --version
Docker version 1.13.0, build 49bf474
sorry for not being able to address this. I want to suggest an issue with a volume bind (are you mapping a local path) but I haven't had any time to put any real thoughts together.
In your docker-compose.yml, if you are using any volume binds, or custom volume plugins, can you specify:
- do all local volume paths exist (are any of them symlinks or cross partition links or networked drives)
- what volume plugins you are using
- if you are populating any system volumes from image volumes.
Hi,
so I think I just encountered the same bug here. I use libcompose to build our apps and when it's run inside Gitlab CI it fails with inappropriate ioctl for device. docker-compose run used to work, it was the setup we used before this tool.
I do bind 2 volumes to perform my tests. For example, I bind the src directory and pom.xml to my container when running a maven container for my tests.
Not sure where to go from there