A docker auth password that contains a colon truncates the password
Closed this issue · 1 comments
joshystuart commented
Expected Behaviour
The docker auth password should not be truncated if it contains a :
Actual Behaviour
The docker auth password is truncated if it contains a :
eg. If the password is password1:1
it will be reduced to password1
.
Testcontainer Logs
Since the password is truncated, it ends up producing the unauthorized
error:
testcontainers [ERROR] Failed to pull image "testcontainers/ryuk:0.5.1": Error: (HTTP code 500) server error - Head "https://registry-1.docker.io/v2/testcontainers/ryuk/manifests/0.5.1": unauthorized: incorrect username or password
Steps to Reproduce
- Create a docker auth password that contains a colon (
:
) - Set the credentials in the
~/.docker/config.json
- Run your tests with testcontainer
Code
You can clearly see in the code it is currently doing a naive string split on :
A simple fix could be something like this:
const [username, ...passwordParts] = decodedAuth.split(":");
const password = passwordParts.join(":");
I will raise a PR.
joshystuart commented
Thanks @cristianrgreco. When will a new build be available with this fix?