-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-podman: stricter container ID regex to avoid bad matches #13307
Conversation
In testing an environment using the docker provider backed by podman-docker, I kept running into a problem where the first time I tried to bring up a container it would fail because it tried to use 'sha256:3' as the container ID. A second attempt to bring up the container would always succeed. On inspection, I think this is happening because, for some reason, the output from the 'docker build' command had a line: Copying config sha256:368a084ba17dcba88f5b23acfa47481131010219524fd9c41af87d709a04845b *after* the line it wants to match on (a line containing just the final container ID). This happens almost every time on one host I'm testing on (which is a Fedora 38 host); it doesn't seem to happen on the other host (which is Fedora 39). I'm not sure why. But we can fix it by just tightening the regex a bit, to only match on a line that *starts* with a 64-character alphanumeric string, not any line that contains one. Signed-off-by: Adam Williamson <[email protected]>
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
Apologies, I don't really know Ruby, so I don't know how to wrap the mock stdout output bit to two lines, if line length is an issue :) |
This is the last few lines of output Vagrant was using, I believe (I added a
Note, I was running |
I can't sign the CLA without my employer (Red Hat) reviewing it first. I have asked for that review. I suspect the change is small enough not to be copyrightable anyway, but I don't know if you want to merge it on that basis. |
aaaand the legal department reminded me Vagrant is no longer F/OSS, which I'd totally forgotten about. Given that, I'm not inclined to sign the CLA. If you want to take the commit as uncopyrightable, I won't complain. |
Thank you for opening this and reporting the issue! Apologies about the delay. |
In testing an environment using the docker provider backed by podman-docker, I kept running into a problem where the first time I tried to bring up a container it would fail because it tried to use 'sha256:3' as the container ID. A second attempt to bring up the container would always succeed.
On inspection, I think this is happening because, for some reason, the output from the 'docker build' command had a line:
Copying config sha256:368a084ba17dcba88f5b23acfa47481131010219524fd9c41af87d709a04845b
after the line it wants to match on (a line containing just the final container ID). This happens almost every time on one host I'm testing on (which is a Fedora 38 host); it doesn't seem to happen on the other host (which is Fedora 39). I'm not sure why. But we can fix it by just tightening the regex a bit, to only match on a line that starts with a 64-character alphanumeric string, not any line that contains one.