Failing in pushing docker image

I’ve been trying to push a docker image to nexus repository manager for 2 days.

I have tried to push to the default port where nexus is running (8081), HTTP 18443 and HTTPS 10001:
docker push localhost:PORT/repository/firstdockerrepo:mytag

170945158084: Preparing
b59b3691e08d: Preparing
2f149da86288: Preparing
92ff06e41201: Preparing
7b76f7b93456: Preparing
c28fdec40c4a: Waiting
8ddec224834c: Waiting
e9db4731c771: Waiting
3de9bbd55c1d: Waiting
8ceb9643fb36: Waiting
error parsing HTTP 404 response body: no error details found in HTTP response body: “{"message":"page not found"}\n”

In nexus, I have the firstdockerrepo, format docker, type hosted. The URL it shows me is http://localhost:8081/repository/firstdockerrepo/.

I have read some posts here in the forum but couldn’t find a similar problem/solution. What can be wrong?

Docker will not use non-root contexts for servers - Docker Registry

If you aren’t a pro user you’ll need option 1 or option 3.

Note also Docker doesn’t like to perform authentication to HTTP repositories.

Hi, Matthew!

Thank you for your message. I will have a look in your suggestion and get back here soon.

Have a great day,

I still can’t make this working.

I am now using NGINX and I can access Nexus at ports :80 and :443 but when I try to login with “docker login” in the command line I always get any of the errors:
http://localhost:PORT/v2/ failed with status: 404 Not Found
Error response from daemon: Get “http://localhost:PORT/v2/”: dial tcp [::1]:PORT: connect: connection refused

I have this in nginx.conf:

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/;

events {
worker_connections 1024;

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {
listen 80;
listen 443 ssl;
server_name localhost;
ssl_certificate /usr/local/etc/nginx/ssl/localhost.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/localhost.key;

   location / {
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

   location /v2/ {
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto "https";

   error_page  500 502 503 504 /50x.html;
   location = /50x.html {
       root  html;


include servers/*;

Can somebody help?