Skip to content

Commit

Permalink
Move login command inside try so we clear env correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Feb 28, 2025
1 parent d3facba commit 342eea9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions repo2docker/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ def docker_login(self, username, password, registry):
shutil.copy2(dc_path, new_dc_path)

os.environ["DOCKER_CONFIG"] = d
proc = subprocess.run(
[
"docker",
"login",
"--username",
username,
"--password-stdin",
registry,
],
input=password.encode(),
check=True,
)
try:
subprocess.run(
[
"docker",
"login",
"--username",
username,
"--password-stdin",
registry,
],
input=password.encode(),
check=True,
)
yield
finally:
if old_dc_path:
Expand Down

0 comments on commit 342eea9

Please sign in to comment.