Skip to content
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

Support for Azure Container Registry #425

Closed
kreeftd opened this issue Nov 1, 2018 · 7 comments
Closed

Support for Azure Container Registry #425

kreeftd opened this issue Nov 1, 2018 · 7 comments

Comments

@kreeftd
Copy link

@kreeftd kreeftd commented Nov 1, 2018

We have problems setting up kaniko together with our GitLab Runner (11.3.1): we are not able to push our Docker builds to our private Azure Container Registry. We believe the issue is in the authentication process. After some debugging, we found that there is a flag for /kaniko/executor: --azure-container-registry-config. However, we are not able to find what file is expected, nor can we find any documentation on this specific flag. Could anyone point us into the right direction? Maybe post an example Azure container registry config file? We appreciate your time and effort. FYI building Docker images works fine, kaniko rocks.

@priyawadhwa

This comment has been minimized.

Copy link
Member

@priyawadhwa priyawadhwa commented Nov 1, 2018

Hey @kreeftd , we actually don't have any special support for Azure in the kaniko image (that flag is added by a dependency, and is meant to be hidden, but I guess that isn't actually working)

You could try mounting in the azure credential helper along with your credentials, which should work. If you want to add the credential helper to the kaniko image, PRs are welcome!

@jon-walton

This comment has been minimized.

Copy link

@jon-walton jon-walton commented Nov 5, 2018

@kreeftd I'm pushing to an azure registry. Using GitLab's docs as an example, I'm doing the following

  script:
    - echo "{\"auths\":{\"$AZURE_REGISTRY\":{\"username\":\"$AZURE_REGISTRY_USER\",\"password\":\"$AZURE_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $AZURE_REGISTRY_IMAGE:$CI_COMMIT_SHA

Seems to be ok so far in testing

@kreeftd

This comment has been minimized.

Copy link
Author

@kreeftd kreeftd commented Nov 5, 2018

@priyawadhwa thank you for your comment.
@jon-walton thank you for your help. I have been relying on the same doc and code, but it seems like I keep running into the following error message.

error pushing image: failed to push to destination <azure registry>/<image name>:<commit tag>: Get https://http/v2/: dial tcp: lookup http on <ip address>:<port>: server misbehaving

It might have something to do with our Kubernetes cluster or GitLab instance. I believe the issue is not in kaniko as you confirmed it should work with said environment variables. Therefore closing issue.

@kreeftd kreeftd closed this Nov 5, 2018
@kreeftd

This comment has been minimized.

Copy link
Author

@kreeftd kreeftd commented Nov 15, 2018

So it turns out we did not setup our environment variables in GitLab correctly. For the Azure Container Registry you should not add http://. Thus, in the example of @jon-walton your environment variables would be similar to:

$AZURE_REGISTRY = 'example.azurecr.io'
$AZURE_REGISTRY_IMAGE = 'example.azurecr.io/example-image-name'

Also note that none of the environment variables in GitLab can be set to privileged. They will result in the following error: error building image: getting stage builder for stage 0: unexpected end of JSON input

@obeleh

This comment has been minimized.

Copy link

@obeleh obeleh commented Mar 23, 2019

I have trouble pushing to ACR:

sample Dockefile:

FROM ubuntu
RUN mkdir /something

sample script

docker run \
    -v /pathto/docker_config.json:/root/.docker/config.json \
    -v /pathto/myapp:/app \
    gcr.io/kaniko-project/executor \
    --dockerfile=Dockerfile \
    --context=/app \
    --destination=something.azurecr.io/bla \
    --cache=true \
    --verbosity debug

output:

INFO[0011] Pushing layer something.azurecr.io/bla/cache:6dde23a1e4752bf36228a640853e4c716795ef06e6e1ddb925be7f75203c6ea6 to cache now
WARN[0012] error uploading layer to cache: failed to push to destination something.azurecr.io/bla/cache:6dde23a1e4752bf36228a640853e4c716795ef06e6e1ddb925be7f75203c6ea6: unexpected end of JSON input
error pushing image: failed to push to destination something.azurecr.io/bla:latest: unexpected end of JSON input
@obeleh

This comment has been minimized.

Copy link

@obeleh obeleh commented May 3, 2019

Apparently -v /pathto/docker_config.json:/root/.docker/config.json should be
-v /pathto/docker_config.json:/kaniko/.docker/config.json

@chaitanyak52

This comment has been minimized.

Copy link

@chaitanyak52 chaitanyak52 commented Jun 20, 2019

Hi @obeleh,
i still get the sam error when i do a run. I tried your fix but still the same error.

error uploading layer to cache: failed to push to destination something.azurecr.io/ttest/cache:072773118be11a007c3572601aa58b4865fea80752a7377da4cc23aeb87b06b3: unexpected end of JSON input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.