Reviewed-on: https://git.chopark.home/wesscho/catalog26/pulls/3
Catalog - Pricing and Availability
SQL
Docker
Create a Local Docker Registry with TLS
On one of the VMs (e.g oahu.chopark.home), set up a local Docker registry. Skip if a local registry already exists.
Prerequisite: Create a CA and a self-signed cert.
docker run -d --restart=always --name registry \
-v /opt/registry/certs:/certs \
-v /opt/registry/data:/var/lib/registry \
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
-p 443:443 \
registry:2
Build a Docker Image
-
Create a
Dockerfile. Refer to theDockerfilein the root of this project. -
Then build the image.
# build an image
docker build -t catalog26 .
# verify the image
docker images | grep catalog26
# also try running it
docker run -d -p 5000:8080 -n catalog26 catalog26
- Tag for my registry.
docker tag catalog26 registry.chopark.home/catalog26
- Push to Registry
docker login registry.chopark.home
docker push registry.chopark.home/catalog26
Optional: If an https error is returned, make the following adjustments.
On Linux, edit /etc/docker/daemon.json:
{
"insecure-registries": ["registry.chopark.home"]
}
sudo systemctl restart docker
On Windows (Docker Desktop):
- Open Docker Desktop
- Go to Settings > Docker Engine
- Add to the JSON configuration
{
"insecure-registries": ["registry.chopark.home"]
}
Kubernetes
- Containerd (on all K8s nodes) for https connection problem
sudo tee /etc/containerd/certs.d/registry.chopark.home/hosts.toml <<EOF
server = "https://registry.chopark.home"
[host."https://registry.choparkhome"]
ca = "/usr/local/share/ca-certificates/regisry.chopark.home-ca.crt"
skip_verify = false
EOF
- Optional Image Pull - create crictl config
# Create crictl config
sudo tee /etc/crictl.yaml > /dev/null <<EOF
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
EOF
# Test crictl
sudo crictl version
# Pull image
sudo crictl pull registry.chopark.home/catalog26
Push Code to Gitea
Push code to git.chopark.home and get the result.
Generate a New ssh Key
ssh-keygen -t ed2551 -C "<EMAIL>" -f ~/.ssh/id_ed25519
Update ssh config
Update the config file for ssh: ~/.ssh/config
# Append the following
Host git.chopark.home
Hostname git.chopark.home
User git
Port 2222
IdentityFile ~/.ssh/id_ed25519
Push code to Gitea
Create a new repository in git.chopark.home.
From the local machine, add gitea as a remote.
git remote add gitea git@git.chopark.home:wesscho/Catalog26.git
git push -u gitea master
Push a Docker Image to Gitea Container Registry
Update your app.ini
Open the gitea/gitea/conf/app.ini file and look for or add the following:
[packages]
ENABLED = true
[repository]
; This allows the 'Packages' tab to show up on your repo page
ENABLE_PACKAGES = true
Configure the Max Upload Size
Docker images are huge. By default, Gitea might limit uploads to 32MB, which will cause your docker push to fail. Add or update this section:
[attachment]
; Increase to 5GB or whatever fits your needs
MAX_SIZE = 5120
Adjust Nginx Proxy Manager (NPM)
Since you are using NPM, it has its own upload limit. If you don't change this, Nginx will give you a 413 Request Entity Too Large error when you push an image.
- Open your NPM Admin UI.
- Edit your Gitea Proxy Host.
- Go to the Advanced tab.
- Paste this line into the "Custom Nginx Configuration" box:
client_max_body_size 5G;
Restart Gitea
For the app.ini changes to take effect, restart your container:
docker compose restart server
Verify and Login
docker login git.chopark.home
Push an Image
If necessary, pull down the image from the registry.chopark.home registry.
docker pull registry.chopark.home/catalog26
Tag the image for the Gitea registry
docker tag registry.chopark.home/catalog26 git.chopark.home/wesscho/catalog26
Push it to your Gitea instance.
docker push git.chopark.home/wesscho/catalog26
third comment