Docker push command is throwing error: '405 Method Not Allowed'

Hi,
I have created a public repository sudhakarbathina/product-basic on docker hub

I am trying to push an image that I created on Rhel EC2 instance. It’s throwing below error.:

error parsing HTTP 405 response body: invalid character ‘<’ looking for beginning of value: “\n405 Method Not Allowed\n

Method Not Allowed

\n

The method POST is not allowed for the requested URL.

\n”

[ec2-user@ip-172-21-31-231 ~]$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don’t have a Docker ID, head over to https://hub.docker.com to create one.
Username: sudhakarbathina
Password:
Login Succeeded
[ec2-user@ip-… ~]$ sudo docker push sudhakarbathina/product-basic
The push refers to a repository [registry.access.redhat.com/sudhakarbathina/product-basic]
4188b2c102db: Preparing
4bc79e8e3d03: Preparing
2829b1fe8676: Preparing
9e4a776bfca4: Preparing
9f5e0b558c16: Preparing
60ab55d3379d: Waiting
error parsing HTTP 405 response body: invalid character ‘<’ looking for beginning of value: “\n405 Method Not Allowed\n

Method Not Allowed

\n

The method POST is not allowed for the requested URL.

\n”

Any help to fix the issue is greatly appreciated. I am using below docker version:

[ec2-user@ip-172-21-31-231 ~]$ docker version
Client:
Version: 1.12.5
API version: 1.24
Package version: docker-common-1.12.5-14.el7.x86_64
Go version: go1.7.4
Git commit: 047e51b/1.12.5
Built: Wed Jan 11 17:53:20 2017
OS/Arch: linux/amd64

Server:
Version: 1.12.5
API version: 1.24
Package version: docker-common-1.12.5-14.el7.x86_64
Go version: go1.7.4
Git commit: 047e51b/1.12.5
Built: Wed Jan 11 17:53:20 2017
OS/Arch: linux/amd64

Same problem~any one knows how to fix it? Thanks!:sweat:

Same problem here, how to fix this?

This is a pain: I get this error on RHEL7 but not on MAC. Latest versions!

Anyone was able to resolve this issue?

@dimplerohara Have a glance here. https://bugzilla.redhat.com/show_bug.cgi?id=1434897#c26

1 Like

please let me know if any one got the answer for this problem . or answer here (https://stackoverflow.com/questions/52074994/docker-push-failed-in-red-hat-server-with-error-parsing-http-405-response-body) i will vote if its work .

Thanks your info helped.

@sudhakarbathina I was facing the same issue, I was trying to push the image to Docker Registry from an EC2 Instance but by default it was taking redhat registry instead of hub.docker registry, to resolve this issue I took the below steps:

  1. Go to /etc/containers/registries.conf
  2. Add/Replace ‘registry.hub.docker.com’ for [registries.search] and [registries.insecure] section.
  3. Restart your VM.
  4. Execute docker login -u -p
  5. Execute the push command and it should work.
2 Likes

Really appreciate your method!

I followed your steps as follows but after making the changes to the Docker registry files, Docker services failed to start:

[registries.search] registries = [‘registry.hub.docker.com’, 'xxxx.xx, 'xxxxxx.xxx., ‘xxx.xx’, ‘xxxx.xxx.xxx’]

[registries.insecure] registries = [registry.hub.docker.com]

After making the above changes, I restarted my VM and the docker services failed to start, I am running Docker on a Red Hat EC2 instance and docker server & client version:m1.13.1.

Any clue, how i can finally push my image to dock hub?

This works Man. Thanks a lot.