At work, Nexus Repos is used for storing Docker image here is some step to learn about it and try Docker push.
We don’t want our data to be lost between each start and stop.
So, we will create the compose file like this
version: "3.9"
services:
nexus:
image: sonatype/nexus3
ports:
- "8081:8081"
- "8082:8082"
volumes:
- ./host-nexus-data:/nexus-data
We expose port 8081
is for web GUI and 8082
is for Docker push.
mkdir ./data
sudo chown 200:200
The default group for Nexus is group id 200.
We need this first to allow Docker process to write to this folder.
WARNING
Directory MUST be created first otherwise the process CANNOT write admin.password or anything else
If you compose up
first, the default root
permission prevent Docker process to writing anything.
Now we can run the compose up!
docker compose up
Then open localhost:8081
Nexus web GUI then Sign in in the top right.
Your password must be here in the docker sync folder
Copy and proceed
Next, next, next after that.
We will then create the repos to store the Docker image.
Click on wheel icon then ‘Create repository’
There is three types of docker
Choose Hosted and fill the info like below:
Then ok. At this point, you will see the repos appear on the listing page.
Login with Docker
This will store at ~/.docker/config.json
for future action.
This is not actually the concept of “login” we are familiar with.
You don’t have to logout to login another registry. When push/pull etc., it will JUST look up user/pass pairs that is matched with the destination.
Just find some random images tag and push.
Here we go the final step is here.
Go to Browse and then our repos the image is end up here:
Information here are:
Hope this helps !
See you then.