The Beginning
Tabunganku is a project where I can learn many things that I haven’t learned in the past. One of them was how to deploy my own images. I researched about private registries, and I found Harbor as one of them.
Experience of Using Harbor
I created a new container using Proxmox using the specification mentioned in the official guide: 2CPU, 4GB of RAM and 40GB storage. I followed the rest of the installation process from the guide, but skipped the HTTPS configuration. What I modified in the configuration file was changing the host name to my own IP address and removing the https
section from the harbor.yml
file.
After I installed Harbor, I shut down the server because it doesn’t run 24/7. In the next day, I tried to access the IP of Harbor, but it returned an error instead. I checked the containers status using docker ps -a
and found several Harbor containers didn’t start. I could access Harbor’s admin page after I run docker compose up
in the terminal. I restarted the instance again to verify the issue. It returned an error as before, so I had to search for a solution.
I checked the docker-compose.yml
file inside the harbor
folder, and the restart: always
flag was there. restart:always
indicates that the container will start after a reboot event. So, I searched the internet to find if other people experienced the same problem. I found a Github issue similar to what I experienced. I read the discussion and added mode: "non-blocking"
inside the docker-compose.yml
file. I restarted the service again, but the service still did not start after reboot.
Using Docker Hub
I didn’t want to spend much time in this issue because there were many things not implemented at the moment. Instead, I used Docker Hub and created two repositories: tabunganku-be
and tabunganku-fe
.
I needed to push the images to Docker Hub before using them. I ran mvn clean install
and docker build -f src/main/docker/Dockerfile -t willystw/tabunganku-be:0.0.1 -t willystw/tabunganku-be:latest .
in the backend’s main directory to build the project, create a container image, and tag it. I did the same thing for the frontend by running docker build -t willystw/tabunganku-fe:0.0.1 -t willystw/tabunganku-fe:latest .
. Following that, I pushed the images to Docker Hub using terminal by running docker login
and docker push willystw/tabunganku-fe:latest
, docker push willystw/tabunganku-fe:0.0.1
, docker push willystw/tabunganku-be:latest
, docker push willystw/tabunganku-be:0.0.1
.
I made modifications to the docker-compose.yml
file to use the uploaded images. I removed the build
context in both projects, changed the image name from tabunganku-backend:latest
and tabunganku-frontend:latest
to willystw/tabunganku-be
and willystw/tabunganku-fe
. Upon executing docker compose up
this time, it fetched the images from Docker Hub.
Other Alternatives
If you use a cloud provider like AWS, you can leverage the services they provide, such as AWS ECR or Google Container Registry. For a self-hosted solution, Distribution and GitLab could be good alternatives. I’ve also just realized that Github has its own container registry. I will have to explore it later.