[SOLVED] Rancher-agent 401 error

Today I setup my ubuntu 14.04 server with docker.
Everything works with docker and cli utilities, downloading images etc.

Now I try to add this host to rancher and I also was successful.

But when I add an application from the catalog I see that the rancher-agent is starting with a 401 client error.
I see this in the rancher-agent logs:

2016-02-23 21:36:00,533 ERROR agent [140125455440144] [event.py:112] Error in request : 285dd989-1c13-45f7-96c7-60e11777a776
Traceback (most recent call last):
  File "/var/lib/cattle/pyagent/cattle/agent/event.py", line 95, in _worker_main
    resp = agent.execute(req)
  File "/var/lib/cattle/pyagent/cattle/agent/__init__.py", line 15, in execute
    return self._router.route(req)
  File "/var/lib/cattle/pyagent/cattle/plugins/core/event_router.py", line 13, in route
    resp = handler.execute(req)
  File "/var/lib/cattle/pyagent/cattle/agent/handler.py", line 34, in execute
    return method(req=req, **req.data.__dict__)
  File "/var/lib/cattle/pyagent/cattle/storage/__init__.py", line 27, in image_activate
    action=lambda: self._do_image_activate(image, storage_pool,
  File "/var/lib/cattle/pyagent/cattle/agent/handler.py", line 72, in _do
  File "/var/lib/cattle/pyagent/cattle/storage/__init__.py", line 28, in <lambda>
  File "/var/lib/cattle/pyagent/cattle/plugins/docker/storage.py", line 149, in _do_image_activate
  File "/var/lib/cattle/pyagent/dist/docker/api/image.py", line 200, in pull
  File "/var/lib/cattle/pyagent/dist/docker/client.py", line 142, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
APIError: 401 Client Error: Unauthorized ("Authentication is required: Get https://registry-1.docker.io/v2/rancher/agent-instance/manifests/v0.8.0: unauthorized: incorrect username or password")

So what could be the problem here?
I constantly see in the rancher ui those starting rancher-agents with the 401 client error.

You are using the same host for the server and agent?

Have you made sure the IP of the host in the Rancher server (UI) is the correct IP?


Hi denise,
I solved the problem when I recreated the Environment again.
I don’t know what was wrong with the env, but now it is working properly again.

What I did once was to change the rancher hostname from hostname to FQDN in the settings.

Thanks for the hint denise.