Can you manually push to that repo with those credentials?
On Thu, Dec 6, 2018 at 6:58 AM Lakshmi Ravipati <[email protected]>
wrote:
> Hi There,
> I am trying to build docker container inside k8s pod. It was working until
> docker-tag but failing to push artifact to private repository.
>
>
> *image-jenkins.json: (Error is below json)*
>
>
>
> {
> "variables":{
> "version":"{{env `version`}}",
> "docker_group_repo":"*<org_prefix>/*",
> "docker_repo":"*<org_prefix>/*",
> "docker_user":"{{env `DOCKER_USER`}}",
> "docker_pwd":"{{env `DOCKER_PWD`}}"
> },
> "sensitive-variables": ["docker_pwd", "AWS_ACCESS_KEY_ID",
> "AWS_SECRET_ACCESS_KEY"],
> "builders":[
> {
> "type":"docker",
> "run_command":[
> "-d",
> "-t",
> "-i",
> "{{.Image}}",
> "/bin/sh"
> ],
> "login":"true",
> "login_server":"{{ user `docker_group_repo` }}",
> "login_username":"{{ user `docker_user` }}",
> "login_password":"{{ user `docker_pwd` }}",
> "image":"*<org_prefix>/*centos:latest",
> "privileged":"true",
> "commit":"true",
> "changes":[
> "USER jenkins",
> "VOLUME /var/run/docker.sock /var/run/docker.sock"
> ]
> }
> ],
> "provisioners":[
> {
> "type": "shell",
> "scripts": ["scripts/modify_resolv_conf.sh"]
> },
> {
> "type":"shell",
> "inline":[
> "rm -rf /var/cache/yum/* /tmp/*"
> ]
> }
> ],
> "post-processors":[
> [
> {
> "type":"docker-tag",
> "repository":"{{ user `docker_repo` }}/devops",
> "tag":"{{ user `version` }}"
> },
> {
> "type":"docker-push",
> "login":"true",
> "login_server":"{{ user `docker_repo` }}",
> "login_username":"{{ user `docker_user` }}",
> "login_password":"{{ user `docker_pwd` }}"
> },
> {
> "type": "manifest"
> }
> ]
> ]
> }
>
>
>
> *Error:*
>
> + packer build -var version=2018-12-06_05_31_23UTC image-jenkins.json*docker
> output will be in this color.*
> *==> docker: Creating a temporary directory for sharing data...**==> docker:
> Pulling Docker image: <org_prefix>/centos:latest* docker: Logging in...
> docker: Login Succeeded docker: latest: Pulling from cwt/cwt-centos
> docker: Digest: sha256: docker: Status: Image is up to date for
> *<org_prefix>/*centos:latest
> docker: Logging out... docker: Removing login credentials for
> *<org_prefix>/*
> *==> docker: Starting docker container...* docker: Run command: docker run
> --privileged -v
> /home/jenkins/.packer.d/tmp/packer-docker155711748:/packer-files -d -t -i
> *<org_prefix>/*centos:latest /bin/sh
> docker: Container ID: 2ab9660a3b9a149277f37b8bea2b6a*==> docker: Using
> docker communicator to connect: <Some_IP>**==> docker: Provisioning with
> shell script: scripts/modify_resolv_conf.sh* docker: updating
> resolv.conf*==> docker: Provisioning with shell script:
> /tmp/packer-shell603282276**==> docker: Committing the container* docker:
> Image ID: sha256:efc6fe4c*==> docker: Killing the container:
> 222414a6e0f43e96942597fab9660a3b9a149277f37b8bea2b6a**==> docker: Running
> post-processor: docker-tag* docker (docker-tag): Tagging image:
> sha256:4f330ba4d17d29bd6
>
> docker (docker-tag): Repository:
> *<org_prefix>/*devops:2018-12-06_05_31_23UTC
>
> *==> docker: Running post-processor: docker-push* docker (docker-push):
> Logging in... docker (docker-push): Login Succeeded docker
> (docker-push): Pushing: *<org_prefix>/*devops:2018-12-06_05_31_23UTC
> docker (docker-push): The push refers to a repository
> [*<org_prefix>/*devops]
> docker (docker-push): 2dce187760d4: Preparing docker (docker-push):
> 1d31b5806ba4: Preparing docker (docker-push): no basic auth credentials
> docker (docker-push): Logging out... docker (docker-push): Removing login
> credentials for *<org_prefix>/*
>
> *Build 'docker' errored: 1 error(s) occurred: * Post-processor failed: Bad
> exit status: 1 ==> Some builds didn't complete successfully and had errors:
> --> docker: 1 error(s) occurred:*
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/760e58c1-ab89-440c-b6ab-fdefebc756e1%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/760e58c1-ab89-440c-b6ab-fdefebc756e1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CALz9Rt8Cw_qSgSS3Vkbz-w3uYHw-mzpFFwVF5SHM%2Bu0yTpk98Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.