I'm using docker-desktop
(version: Docker version 20.10.12, build e91ed57
) on macOS
My problem: Can not connect and push image to the nexus registry container
Here is my steps & errors:
Pull & Start nexus container
docker volume create --name nexus-data
docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-dasonatype/nexus3:3.37.3
Connect to the
0.0.0.0:8081
Then i connect to the 0.0.0.0:8081
and create a docker-hosted
repository and in HTTP
section i add the 8083
port.
then i create a user (ali
) and assigned to it a password and a role
- add
insecure-registries
to the docker engine
then according to this documentation i added this line to the docker engine
:
"insecure-registries": ["0.0.0.0:8083"]
- restart the docker and container
- try to login
then i tried to login via this command:
docker login 0.0.0.0:8083
but it return an error:
Error response from daemon: Get "http://0.0.0.0:8083/v2/": dial tcp 0.0.0.0:8083: connect: connection refused
Why i get this error?!
i tried many things to solve my problem including:
- Open port
8083
on my machine - add the
0.0.0.0
to my host file - open port
8083
on my container too
but nothing works at all!
what should i do?!
CodePudding user response:
To access a port in the container from the host, it needs to be published. So the run command should be
docker run -d -p 8081:8081 -p 8083:8083 --name nexus -v nexus-data:/nexus-dasonatype/nexus3:3.37.3