You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dockertest.Resource.Exec(..., dockertest.ExecOptions{StdOut: ..., StdErr: ..., TTY: true}) fails with Start exec failed: Unrecognized input header: 100. This happens regardless of whether the corresponding container has been created with or without Tty: true.
Reproducing the bug
By("spinning up a Docker container with stand-alone containerd, courtesy of the KinD k8s sig")
pool:=Successful(dockertest.NewPool("unix:///var/run/docker.sock"))
_=pool.RemoveContainerByName(kindischName)
// The necessary container start arguments come from KinD's Docker node// provisioner, see:// https://github.com/kubernetes-sigs/kind/blob/3610f606516ccaa88aa098465d8c13af70937050/pkg/cluster/internal/providers/docker/provision.go#L133//// Please note that --privileged already implies switching off AppArmor.//// Please note further, that currently some Docker client CLI flags// don't translate into dockertest-supported options.//// docker run -it --rm --name kindisch-...// --privileged// --cgroupns=private// --init=false// --volume /dev/mapper:/dev/mapper// --device /dev/fuse// --tmpfs /tmp// --tmpfs /run// --volume /var// --volume /lib/modules:/lib/modules:ro// kindisch-...providerCntr=Successful(pool.BuildAndRunWithBuildOptions(
&dockertest.BuildOptions{
ContextDir: "./test/kindisch", // sorry, couldn't resist the pun.Dockerfile: "Dockerfile",
BuildArgs: []docker.BuildArg{
{Name: "KINDEST_BASE_TAG", Value: test.KindestBaseImageTag},
},
},
&dockertest.RunOptions{
Name: kindischName,
Privileged: true,
Mounts: []string{
"/dev/mapper:/dev/mapper",
"/var",
"/lib/modules:/lib/modules:ro",
},
Tty: true,
}, func(hc*docker.HostConfig) {
hc.Init=falsehc.Tmpfs=map[string]string{
"/tmp": "",
"/run": "",
}
hc.Devices= []docker.Device{
{PathOnHost: "/dev/fuse"},
}
}))
Never mind bothering with answering this bug issue and even fixing this obvious incompatibility with the Docker API's 100 CONTINUE.
For those stumbling upon the same problem, I've fixed it. I've simply written my own replacment for this module (not a drop-in), using the official Docker Go client, designing a neat function option API that works so much better than anticipated, and large test coverage on top, so I'm now replacing dockertest in company projects as well as my own. Now I have proper diagnosis ouput from builds, container runs, and command execs inside containers whenever a unit test fails. FYI, https://github.com/thediveo/morbyd
The above unit test excerpt now becomes as follows, properly streaming build and container output, without even needing to use a pseudo TTY:
By("spinning up a Docker container with stand-alone containerd, courtesy of the KinD k8s sig")
Expect(sess.BuildImage(ctx, "./_test/kindisch",
build.WithTag(img.Name),
build.WithBuildArg("KINDEST_BASE_TAG="+test.KindestBaseImageTag),
build.WithOutput(timestamper.New(GinkgoWriter)))).
Error().NotTo(HaveOccurred())
providerCntr=Successful(sess.Run(ctx, img.Name,
run.WithName(kindischName),
run.WithAutoRemove(),
run.WithPrivileged(),
run.WithSecurityOpt("label=disable"),
run.WithCgroupnsMode("private"),
run.WithVolume("/var"),
run.WithVolume("/dev/mapper:/dev/mapper"),
run.WithVolume("/lib/modules:/lib/modules:ro"),
run.WithTmpfs("/tmp"),
run.WithTmpfs("/run"),
run.WithDevice("/dev/fuse"),
run.WithCombinedOutput(timestamper.New(GinkgoWriter))))
Preflight checklist
Ory Network Project
No response
Describe the bug
dockertest.Resource.Exec(..., dockertest.ExecOptions{StdOut: ..., StdErr: ..., TTY: true})
fails withStart exec failed: Unrecognized input header: 100
. This happens regardless of whether the corresponding container has been created with or withoutTty: true
.Reproducing the bug
Relevant log output
No response
Relevant configuration
No response
Version
v3.10.0
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker
Additional Context
No response
The text was updated successfully, but these errors were encountered: