-
Notifications
You must be signed in to change notification settings - Fork 97
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
Attempting AWS ECR integration #59
Comments
Actually I looked into it a little more, and it's kind of a mess. I tried to hack it quickly, see if the patch below works for you. --- docker.sh 2021-02-18 03:04:09.439331125 -0800
+++ /usr/lib/enroot/docker.sh 2021-02-18 03:07:30.389338296 -0800
@@ -62,17 +62,26 @@ docker::_authenticate() {
fi
fi
- # Request a new token.
- common::curl "${curl_opts[@]}" -G ${req_params[@]+"${req_params[@]}"} -- "${realm}" \
- | common::jq -r '.token? // .access_token? // empty' \
- | common::read -r token
+ if [[ "${registry}" =~ \.amazonaws\.com$ ]] && [ -v fd ]; then
+ grep "machine[[:space:]]\+${registry}[[:space:]]\+login[[:space:]]\+${user}" <&${fd} \
+ | awk '{print "AWS:"$6}' \
+ | base64 -w 0 \
+ | common::read -r token
+ auth="Basic"
+ else
+ # Request a new token.
+ common::curl "${curl_opts[@]}" -G ${req_params[@]+"${req_params[@]}"} -- "${realm}" \
+ | common::jq -r '.token? // .access_token? // empty' \
+ | common::read -r token
+ auth="Bearer"
+ fi
[ -v fd ] && exec {fd}>&-
# Store the new token.
if [ -n "${token}" ]; then
mkdir -m 0700 -p "${token_dir}"
- (umask 077 && printf 'header "Authorization: Bearer %s"' "${token}" > "${token_dir}/${registry}.$$")
+ (umask 077 && printf 'header "Authorization: %s %s"' "${auth}" "${token}" > "${token_dir}/${registry}.$$")
common::log INFO "Authentication succeeded"
fi
}
@@ -111,7 +120,7 @@ docker::_download() {
local -r user="$1" registry="${2:-registry-1.docker.io}" tag="${4:-latest}" arch="$5"
local image="$3"
- if [[ "${image}" != */* ]]; then
+ if [[ "${image}" != */* ]] && [[ ! "${registry}" =~ \.amazonaws\.com$ ]]; then
image="library/${image}"
fi I tried with the following credentials:
Where the AWS CLI is installed this way: And I could pull the following (from here): |
Hi @3XX0 Many thanks for the patch - I have successfully applied the patch and can confirm that this appears to successfully authenticate against out ECR. Im assuming that the .credentials file should look like:
and not have
Frustratingly, I did come up against another issue for a few of our images:
However I think this is probably enroot configuration related and Im still digging into that... Edit: ok, it looks like the 'Cannot mknod' issue might be a problem with the images themselves not being able to run unprivileged.... Thanks again. |
Good to know, I will clean up the patch and merge it when I have time. Regarding your error, |
Thanks @3XX0 I had a quick look and hacked in the following line:
This is working for me tho I will be honest Im not 100% sure there will be no side effects!! I had a look at the following serverfault post which suggests a convoluted work around - I assumed you could supply tar with multiple patterns. Edit: This was the base image that was causing us issues if you want to test for yourself: bitnami/minideb:buster Best, |
Hi Guys,
Thanks for your help over on NVIDIA/pyxis#34.
Im attempting to configure enroot on an EC2 instance within my VPC to point to our ECR but am running into an issue Im struggling to debug. Im assuming it is something I have misconfigured but cannot see what...
I have confirmed the following:
aws ecr get-login-password
returns a token.(Note: I have obfuscated the ECR url)
I have created a readable credentials file at /etc/enroot/.credentials:
when I call the following command I get a 404 not found error:
I hacked in a bit of additional logging to see what was going on:
and got the following output:
If I attempt to use the doker daemon, the following command does works as expected:
I feel like I am missing something simple...
I appreciate that AWS is not your primary target but any suggestions would be well received!
Best
Jon
The text was updated successfully, but these errors were encountered: