docker-push - tagging image fails (not bad brackets)

309 views
Skip to first unread message

Keiran Raine

unread,
Nov 23, 2016, 2:35:17 PM11/23/16
to Packer
Hi,

I have a very simple test process for a build and tag but I seem to be getting errors:

==> docker: Committing the container

    docker: Image ID: sha256:8f2ebfea819e328632c797f72296870c8b7134fe9a37ed1f05f19b0db96dc6c1

==> docker: Killing the container: cfe10779a6c8bd34d03e893c00bc186e90bee4c3f0b709037788d3b33802172d

==> docker: Running post-processor: docker-tag

    docker (docker-tag): Tagging image: sha256:8f2ebfea819e328632c797f72296870c8b7134fe9a37ed1f05f19b0db96dc6c1

    docker (docker-tag): Repository: keiranmraine/testspace:0.0

Build 'docker' errored: 1 error(s) occurred:


* Post-processor failed: Error tagging image: exit status 125

Stderr: unknown shorthand flag: 'f' in -f

See 'docker tag --help'.


build.json:

{

  "variables":

  {

    "created_image_name": "{{env `CGPBOX_BASE_NAME`}}",

    "dock_email": "{{env `DOCK_EMAIL`}}",

    "dock_username": "{{env `DOCK_UNAME`}}",

    "dock_password": "{{env `DOCK_PW`}}",

    "dock_server": "{{env `DOCK_SERVER`}}",

    "dock_source": "{{env `DOCK_SOURCE`}}",

    "dock_dest": "{{env `DOCK_DEST`}}",

    "cgpbox_version": "master"

  },

  "builders":

  [

    {

      "type": "docker",

      "image": "{{user `dock_source`}}",

      "commit": true

    }

  ],

  "provisioners":

  [

    {

      "type": "shell",

      "environment_vars": ["CGPBOX_VERSION={{user `cgpbox_version`}}"],

      "scripts": ["simple.sh"]

    }

  ],

  "post-processors": [

    [

      {

        "type": "docker-tag",

        "repository": "{{user `dock_username`}}/{{user `dock_dest`}}",

        "tag": "{{user `cgpbox_version`}}",

        "force": "true"

      },

      {

        "type": "docker-push",

        "login": true,

        "login_email": "{{user `dock_email`}}",

        "login_username": "{{user `dock_username`}}",

        "login_password": "{{user `dock_password`}}",

        "login_server": "{{user `dock_server`}}"

       }

    ]

  ]

}



The script just adds 'time' to the default ubuntu:16.04 image via apt-get.

Any help welcome.

Thanks,
Keiran

Rickard von Essen

unread,
Nov 23, 2016, 3:10:20 PM11/23/16
to packe...@googlegroups.com

-f has been removed from docker tag (and is now implied). Just add force: false to your docker-tag post-processor.


--
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/784cb48f-b0a4-49b8-868b-d98efe213f78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Keiran Raine

unread,
Nov 23, 2016, 3:42:16 PM11/23/16
to Packer
Thank you that has resolved that issue, and I've progressed to an issue during the actual push.

It appears to login successfully but then I get an 'authentication required' message:

==> docker: Running post-processor: docker-push

    docker (docker-push): Logging in...

    docker (docker-push): Login Succeeded

    docker (docker-push): Pushing: keiranmraine/testspace:master

    docker (docker-push): The push refers to a repository [docker.io/keiranmraine/testspace]

    docker (docker-push): b4bf40c16663: Preparing

    docker (docker-push): c1bd37d01c89: Preparing

    docker (docker-push): 943edb549a83: Preparing

    docker (docker-push): bf6751561805: Preparing

    docker (docker-push): f934e33a54a6: Preparing

    docker (docker-push): e7ebc6e16708: Preparing

    docker (docker-push): e7ebc6e16708: Waiting

    docker (docker-push): unauthorized: authentication required

    docker (docker-push): Logging out...

    docker (docker-push): Remove login credentials for quay.io


Any ideas?
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

Alvaro Miranda Aguilera

unread,
Nov 23, 2016, 4:11:25 PM11/23/16
to packe...@googlegroups.com

On Wed, Nov 23, 2016 at 9:42 PM, Keiran Raine <k...@sanger.ac.uk> wrote:
docker (docker-push): unauthorized: authentication required

try doing a docker login  before the packer build





--
Alvaro

Rickard von Essen

unread,
Nov 23, 2016, 4:17:45 PM11/23/16
to packe...@googlegroups.com

This looks wrong:


docker (docker-push): The push refers to a repository [docker.io/keiranmraine/testspace]

...

docker (docker-push): Logging out...
docker (docker-push): Remove login credentials for quay.io

Which registry do you use?


--
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0exWirA76KVhZreqkv1aSpwdAKyMD-W227-Foz%2BXCuJdBw%40mail.gmail.com.

Keiran Raine

unread,
Nov 23, 2016, 4:39:54 PM11/23/16
to Packer
Thanks, from that spot I figured out I needed to change from:

      {
        "type": "docker-tag",
        "repository": "{{user `dock_username`}}/{{user `dock_dest`}}",
        "tag": "{{user `cgpbox_version`}}"
      },

to

      {
        "type": "docker-tag",
        "repository": "{{user `dock_server`}}/{{user `dock_username`}}/{{user `dock_dest`}}",
        "tag": "{{user `cgpbox_version`}}"
      },



On Wednesday, 23 November 2016 21:17:45 UTC, Rickard von Essen wrote:

This looks wrong:
docker (docker-push): The push refers to a repository [docker.io/keiranmraine/testspace]
...
docker (docker-push): Logging out...
docker (docker-push): Remove login credentials for quay.io

Which registry do you use?

On Nov 23, 2016 10:11 PM, "Alvaro Miranda Aguilera" <kik...@gmail.com> wrote:

On Wed, Nov 23, 2016 at 9:42 PM, Keiran Raine <k...@sanger.ac.uk> wrote:
docker (docker-push): unauthorized: authentication required

try doing a docker login  before the packer build





--
Alvaro

--
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 packer-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages