newrelic/centurion

Can't add private docker image

pelcasandra opened this issue · 9 comments

I have something like this on my config/centurion/mysite.rake.

  task :common do
    set :image, 'https://registry.hub.docker.com/u/myorgn/myrepo'
  end

When I run centurion -p trendnu -e production It doesn't get the right URL.

** Invoke list:tags (first_time)
** Execute list:tags
GET: "https://registry.hub.docker.com/v1/repositories/https://registry.hub.docker.com/u/myorg/myrepo//tags"

If I try simply set :image, 'myorg/myrepo' then I get the following URL error

** Execute list:tags
GET: "https://pelcasandra/v1/myorg/myrepo/tags"

Is this a bug or I'm missing something? Thanks.

Looks that the regex on uri_for_repository_path method is not matching an image when its name has a trailing slash like my case pelcasandra/trendnu and is interpreting it as an url instead. I just tried adding a nasty http in the regex to make sure it works.

https://github.com/pelcasandra/centurion/blob/master/lib/centurion/docker_registry.rb#L69

Now it tries to fetch the URL, but since is private it isn't working. I can try to pass the username and pass in the URL but is there any plan to support Docker private images?

Private Images stored on docker seems to be the facto way, its very rare that isn't already supported by Centurion.

Hi @pelcasandra , we definitely use Docker Hub as a remote registry here. Our configs with it look like this:

set :image, 'registry.hub.docker.com/orgname/reponame'

Hi @benders, this isn't working for me. If I try the following

  task :common do
    set :image, 'registry.hub.docker.com/myusername/myrepo'
  end

Centurion tries to fetch this url

** Invoke list:tags (first_time)
** Execute list:tags
GET: "https://registry.hub.docker.com/v1/repositories/registry.hub.docker.com/myusername/myrepo/tags"

Is this a bug? Any workaround for this? Thanks!

Definitely a bug. What version of Centurion and Ruby are you using? I'm using Centurion 1.0.10 on Ruby 2.1.1.

I'm using Centurion 1.1.1 and Ruby 2.1.3.

If I try with Centurion 1.0.10 it seems to be fetching this url instead.

GET: "/v1/repositories/registry.hub.docker.com/myorg/myrepo/tags" 

And following with this error

E, [2014-10-10T20:46:22.087687 #89181] ERROR -- : Couldn't communicate with Registry: #<Excon::Response:0x007f866c054408 @data={:body=>"\n\n\n<!DOCTYPE html><!--[if lt IE 7]><html class=\"no-js lt-ie9 lt-ie8 lt-ie7\"><![endif]--><!--[if IE 7]><html class=\"no-js lt-ie9 lt-ie8\"><![endif]--><!--[if IE 8]><html class=\"no-js lt-ie9\"><![endif]--><!--[if gt IE 8]><!--><html class=\"no-js\"><!--<![endif]--><head profile=\"http://a9.com/-/spec/opensearch/1.1/\"><meta charset=\"utf-8\"><!-- [if it IE]><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"><script type=\"text/javascript\">window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o?o:e)},o,o.exports)}return e[n].exports}if(\"function\"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({QJf3ax:[function(t,e){function n(t){function e(e,n,a){t&&t(e,n,a),a||(a={});for(var c=u(e),f=c.length,s=i(a,o,r),p=0;f>p;p++)c[p].apply(s,n);return s}function a(t,e){f[t]=u(t).concat(e)}function u(t){return f[t]||[]}function c(){return n(e)}var f={};return{on:a,emit:e,create:c,listeners:u,_events:f}}function r(){return{}}var o=\"nr@context\",i=t(\"gos\");e.exports=n()},{gos:\"7eSDFh\"}],ee:[function(t,e){e.exports=t(\"QJf3ax\")},{}],gos:[function(t,e){e.exports=t(\"7eSDFh\")},{}],\"7eSDFh\":[function(t,e){function n(t,e,n){if(r.call(t,e))return t[e];var o=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:o,writable:!0,enumerable:!1}),o}catch(i){}return t[e]=o,o}var r=Object.prototype.hasOwnPr
....

It looks to me like #49 fixes the generated URL issue against Centurion 1.1.1, so I will merge that. Thanks for helping us chase this down.

Any idea when this will be merged?

I just merged #49 and would appreciate if you can tell us if that fixes your issue @pelcasandra .