-
Notifications
You must be signed in to change notification settings - Fork 370
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
Switch to using CLI for everything except running the container #1421
base: main
Are you sure you want to change the base?
Conversation
Preserves existing authentication information handling behavior: 1. If registry_credentials are present, they are used but not leaked on to existing ~/.docker/config 2. If registry_credentials are not present, they are not used 3. Regardless of registry_credentials being present, we still will use existing authentication info in DOCKER_CONFIG
efda911
to
ac0def4
Compare
repo2docker/docker.py
Outdated
|
||
env = os.environ.copy() | ||
subprocess.check_call( | ||
# FIXME: This should be using --password-stdin instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to manipulate the config.json
file directly:
json.dumps({"auths":{"<might need a scheme here://>registry.host":{"auth":b64encode(f"{user}:{token}".encode()).decode()}}})
It's also what we do to create the BinderHub secret:
https://github.com/jupyterhub/binderhub/blob/579dd78430422bae896c90d69ffad637d9fcfc26/helm-chart/binderhub/templates/_helpers.tpl#L40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manics I did consider that, but then we'll have to merge the existing ~/.docker/config file with the new setup carefully. I would rather just outsource it to docker login
like this instead.
The failing tests are because of the mock for the existing push. This is also why we couldn't catch #1413 |
56b64d9
to
8444a28
Compare
f5ea6d3
to
69e67a2
Compare
So, I'm just going to run a docker registry and test. Unfortunately while docker push works fine with registries on http, docker login does not without us changing docker daemon config to allow |
da1731c
to
a8369be
Compare
for more information, see https://pre-commit.ci
Also properly setup TLS for docker daemon to close security hole
5f00ce3
to
48da2c1
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
ok, moving |
I'm going to scope this back to just trying to implement docker push via the CLI again :) |
ebeb4c9
to
aa948e0
Compare
531fb5e
to
0f68056
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR originally was to try to convert just
push
to using the CLI, but expanded tomake some changes to how we were using docker-py for anything other than running
containers. Running containers should also be switched to using the CLI, but in a separate
PR.
find_images
method in the ContainerEngine interface, as it wasonly being used inefficiently to iterate through all images to check if a single
image exists. Instead we now use inspect_image (which can return a None
if the image does not exist). This is a breaking change for other container engines
push
method from the ContainerEngine interface. This is abreaking change.
push
andload
params tobuild
.push
will automatically push the resultingimage to the registry, while
load
will ensure it's loaded onto the local image store and beready to run.
push
never is called without a build in our codebase, so this is fine. It allows usto not load the image into the local image store when only pushing, as is the case with binderhub.
load
is only set if the image is to be run by repo2docker.registry_credentials
is in the right formFor authentication, we preserve existing authentication information handling behavior:
on to existing ~/.docker/config
existing authentication info in DOCKER_CONFIG
This authentication behavior is tested as well!
Removed functionality
This does remove the functionality of testing at start time if docker api is accessible, and failing if it is not. This is because we now have two ways to access the docker api - cli and python, and I don't want to repeatedly do it for both (plus it was causing the registry test to fail, even though that only used the cli). I propose we let this be, and add it back once we get rid of dockerpy completely.
TODO
Fixes #1414