Docker Community Forums

Share and learn in the Docker community.

Error response from daemon: Unexpected status code 401

I logged into the Docker container on centos7

Docker search nginx command is executed

Error response from Daemon: Unexpected status code 401

However, I use docker logout when using the Docker search nginx command

It will display normally


I don’t know what it is but just a few days ago it was fine, okay

I can confirm that no configuration files have been changed
Oddly enough, my Docker is installed by yum
Who can help solve this problem? It has been bothering me for a long time

1 Like

Is it Docker in Docker or is it just an other Docker client in a container?

When you try to log in again an run docker search, do you get the same message every time? It looks like your credentials stored incorrectly and docker can’t use that.

This is a platform built with centos7 cloud server

An error occurs when using the docker search command in centos 7

Yes, every time I use the search command it returns this error

I tried to use someone else’s Docker account on my other server but still returned this error

Both server Docker environments are consistent with yum installations

Both servers exit accounts and the search command can be used normally

If it’s a credential store problem how do I remove it

Corresponding question link:

https://github.com/wwwwtkx/etcd/issues/2

Side note:
I’m getting something similar when searching, context below:
Successfully logged in & trying to search docker hub registry via CLI on Mac Host.

Authenticated: Yes, with docker login command, using an AccessToken as 2FA is enabled
HostOS: Mac
Search interface: CLI
Command: docker search mysql
Output: Error response from daemon: Unexpected status code 401

Seems like there may be a relation hence the post.
What’s the log command or best place to view interactive or verbose logs?

Cheers

Ok, I tried it. I got the same error message. Sorry, I thought it was something related only to your environment since I have never experienceeed this. The truth is I don’t really use “docker search” anymore. I can investigate it later.

It does not work

Well, I thought I was the only one
Thank you for your

Hi, I have the same problem as you.
Did you find a solution by any chance…?

n$ docker search oracle-xe-11g

Error response from daemon: Unexpected status code 401

Hi, I have the same issue been going on for a couple days now. Only happened after the latest upgrade on my Mac.
Docker engine version 20.10.8
Docker desktop version 4.1.1

I am logged in to my account correctly. Was able to pull, tag, commit, push from the command line to my repository but cannot search. Getting the same error code.
Error response from daemon: Unexpected status code 401

1 Like

Its broken in version 20.10.10 on Ubuntu as well, but to my suprise works 20.10.3 on my Synology NAS and on 20.10.9 in WSL2 Ubuntu 20.04
Possibly a breakging in the client that no one noticed?

Reporting the same error here:

docker search mariadb
Error response from daemon: Unexpected status code 401

I am successfully logged in, yet I got this error.

Docker version 20.10.10, build b485636
Using Debian 4.19.208-1

1 Like

Updating 20.10.9 to 20.10.10 (b485636) in Ubuntu 20.04/WSL2 still works.
It does not work with 20.10.10 (b485636) in Ubuntu 18.04 with normal user (not added to docker group), but works like a charm with root:

me@swarm1:~$ docker search nginx
Error response from daemon: Unexpected status code 401
me$ sudo -i
root@swarm1:~# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 15759 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 2088 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 818 [OK]
jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 270
linuxserver/nginx An Nginx container, brought to you by LinuxS… 159
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 143 [OK]
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 142 [OK]
alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou… 110 [OK]
nginxdemos/hello NGINX webserver that serves a simple page co… 76 [OK]
privatebin/nginx-fpm-alpine PrivateBin running on an Nginx, php-fpm & Al… 60 [OK]
nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo… 55
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 54
staticfloat/nginx-certbot Opinionated setup for automatic TLS certs lo… 25 [OK]
nginxproxy/nginx-proxy Automated Nginx reverse proxy for docker con… 24
nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN… 22
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… 19 [OK]
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 15
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 13
mailu/nginx Mailu nginx frontend 9 [OK]
navidonskis/nginx-php5.6 Docker nginx + php5.6 on Ubuntu 7 [OK]
sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a… 7 [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 3 [OK]
wodby/nginx Generic nginx 1 [OK]
arnau/nginx-gate Docker image with Nginx with Lua enabled on … 1 [OK]
centos/nginx-110-centos7 Platform for running nginx 1.10 or building … 0

I guess the root user is not logged in. I am trying to set up a squid proxy to see the requests that gives us the HTTP 401.

You are right!

I though I hadn’t done a login on this node with the unprivilged user, but appearently I did: it’s right there → cat ~/.docker/config.json

On another node, I checked cat ~/.docker/config.json with the unpriviliged user → the file doesn’t exist. Thus, no login credentials. Worked with the unprivilleged user as well.

So the issue only seem to affect logged-in users. Still odd…

I tried to search through a proxy server

# With proxy and not allowed domain
$ docker search centos
Error response from daemon: Get "https://index.docker.io/v1/search?q=centos&n=25": Forbidden

# Without proxy
$ docker search centos
Error response from daemon: Unexpected status code 401

Then I tried the url which was denied by the proxy:

curl 'https://index.docker.io/v1/search?q=centos&n=1'
{"num_pages":58976,"num_results":58976,"page_size":1,"page":1,"query":"centos","results":[{"name":"centos","description":"The official build of CentOS.","star_count":6843,"is_trusted":false,"is_automated":false,"is_official":true}]}

So it tries to search with the right URL but I could not get the http headers with tcpdump. It is https so that is a little harder and I am not so good at it yet :slight_smile: .

I also tried

strace docker search centos

where I found some error message which did not help me a lot. Then I downloaded the source code to see how the search and credentials work. I could probably find some API reference and maybe I will search for it later. Although I really don’t use docker search. I don’t consider it useful but the issue is interesting.

This is suddenly happening for me as well. I can’t search while logged in, but it works if I log out. If I then log in with a fresh token, it’s broken again.

I’m on Arch, Docker version 20.10.10, build b485636f4b.

Same on windows + wsl.
Administrator or normal CMD mode - no changes

Hi,

I to have same error while searching for ubuntu. Please let me how to fix this issue
Thanks in advance!

image

I couldn’t find a solution yet and I am not sure when I will have time. Actually, I don’t see any real value in the docker search command. Can you or anyone tell me, why you would like to search in command line? Is there any use case in which you don’t have any graphical interface or browser to search on Docker Hub using a web browser? I used to search for LXD images in command line since LXD images don’t have a long README with instructions, only image name, a very short description and some metadata. In case of Docker the command line is not enough for me.

The same issue :pensive:
Windows 21H1 / Docker 20.10.8 / use WSL2

(post deleted by author)