parabuzzle / craneoperator

Gives you a simple web interface for browsing around a Docker Registry
https://hub.docker.com/r/parabuzzle/craneoperator
MIT License
127 stars 32 forks source link

Oj::ParseError at /api/containers ind server.rb #53

Open colorcube opened 6 years ago

colorcube commented 6 years ago

For some reason the communication from the server to the registry doesn't work. I can't find a configuration error.

The registry is not behind a proxy on port 5000. image: 'registry:2' Basic auth is enabled. The registry is tested with curl and browser.

https://myregistry.example.com:5000/v2/_catalog returns: {"repositories":["test/hello-world"]}

I set the environment as follows:

environment:

  - REGISTRY_HOST=myregistry.example.com
  - REGISTRY_PORT=5000
  - REGISTRY_PROTOCOL=https
  - SSL_VERIFY=false
  - REGISTRY_USERNAME=testuser
  - 'REGISTRY_PASSWORD=123'
  - REGISTRY_ALLOW_DELETE=true
  - 'SESSION_SECRET=something'
  - DEBUG=true

(I changed secret values here)

When I login into the container I can see that the environment is set to those values. I can use curl to access the registry from within the container with those values.

The frontend works but calling the server with /api/containers returns an exception:

application error
Oj::ParseError at /api/containers
unexpected character at line 1, column 5 [parse.c:690]

file: helpers.rb location: load line: 46 

BACKTRACE

/webapp/lib/helpers.rb in load
json = Oj.load response.body
/webapp/lib/helpers.rb in get
json = Oj.load response.body
/webapp/server.rb in fetch_catalog
json = get("/v2/_catalog", conf, session, {}, query)
/webapp/server.rb in containers
repos = fetch_catalog
/webapp/server.rb in block in <class:CraneOp>
repos = containers(params[:filter])
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli/exec.rb in load
Kernel.load(file)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli/exec.rb in kernel_load
Kernel.load(file)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli/exec.rb in run
    return kernel_load(bin_path, *args)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli.rb in exec
Exec.new(options, args).run
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/vendor/thor/lib/thor/command.rb in run
    instance.__send__(name, *args)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/vendor/thor/lib/thor/invocation.rb in invoke_command
    command.run(self, *args)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/vendor/thor/lib/thor.rb in dispatch
instance.invoke_command(command, trailing || [])
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli.rb in dispatch
super do |i|
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/vendor/thor/lib/thor/base.rb in start
    dispatch(nil, given_args.dup, nil, config)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/cli.rb in start
super
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/exe/bundle in block in <top (required)>
Bundler::CLI.start(args, :debug => true)
/usr/local/lib/ruby/site_ruby/2.3.0/bundler/friendly_errors.rb in with_friendly_errors
yield
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/exe/bundle in <top (required)>
Bundler.with_friendly_errors do

The registry logs are empty (no access from the server?).

When I run tcpdump on both ends I can see they are talking to each other.

I tried two or three 2.x versions.