We have ended up with the following file-structure for the reverse proxy image:
Validate your results by typing docker build . on the command line inside the reverse folder. It should download the base image and add the required files.
Bring it together
We now have a reverse proxy configured to forward all traffic towards the Nexus repository. All we need is to put them together in a single docker-compose environment, so that they can communicate. Go to the root folder of your project and edit the docker-compose.yml file. We will add some lines, so that the result will be:
Everything we added is in the reverse proxy service:
The docker image will be identified by the name reverse-proxy
It is not a downloaded image like nexus, but instead it's a locally built image that can be telegram data found in the reverse folder
It exposes a number of ports to the outside world, most specifically port 443 , 8082 and 8083 . The others are there for future use.
Running and testing
Now that we have both Nexus and Nginx in the docker-compose, it is time to start using it. Make sure your previous compose is stopped by typing docker-compose stop
Go to the main directory and build the composition by running docker-compose build (without the . that docker build . uses). You should see output like this:
Now we are ready to run the composition for the first time. Run it with docker-compose up so that it creates missing volumes if needed. To run it afterwards, use docker-compose start instead.
Before we can login, we need to make sure we can find the host mydocker . As discussed before, it needs to be registered. The simplest way is to register the name on the local machine:
On Linux, edit the file /etc/hosts
On windows, edit the file C:WindowsSystem32driversethosts
Add the following line:
127.0.0.1 mydockerCopy
This tells your computer that any traffic for mydocker will be routed towards the loopback ip number.
Now we can start testing. Try to log in to your repository by entering the following command
docker login mydocker
You will be asked for credentials. Provide the username and password for the user you created.
The command should end with the message “Login succeeded”
You are now logged on to the group repository that also contains the reference to docker-hub. Confirm this by doing a docker pull nginx.
Nexus-data:Copy
-
- Posts: 68
- Joined: Wed Dec 18, 2024 5:49 am