Build a custom docker image
For eg, added custom configs to apache
Create custom Dockerfile
Here it will pull latest apache and copy httpd.conf and mka-site.conf to the build custom build image.
Make sure you have customized httpd.conf and mka-site.conf files in “apache-config/” dir
#DockerfileCopy code
# Use an existing Apache image as base
FROM httpd:latest
# Copy custom configuration files
COPY ./apache-config/httpd.conf /usr/local/apache2/conf/httpd.conf
COPY ./apache-config/mka-site.conf /usr/local/apache2/conf/extra/mka-site.conf
# Optionally, copy website files
# COPY ./mysite /usr/local/apache2/htdocs/
Build image
docker build -t custom-apache-image .
[+] Building 4.6s (8/8) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 374B 0.0s
=> [internal] load metadata for docker.io/library/httpd:latest 2.5s
=> [internal] load .dockerignore ....
....
=> => naming to docker.io/library/custom-apache-image:latest 0.0s
=> => unpacking to docker.io/library/custom-apache-image:latest 0.0s
manish@docker-lab:~/custom-apache-image$
List images to see new image
docker images
i Info → U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
custom-apache-image:latest a14d53dfe52e 175MB 45.2MB
hello-world:latest f7931603f70e
Enable docker packages on Gitea
Add following in Gitea config
[packages]
docker__ENABLED = true
ENABLED = true
Gitea repo
Create a new repo on gitea “custom-apache” from WebUI
Docker login to gitea repo
It will prompt for gitea login/password
docker login http://192.168.1.43:31300
Login Succeeded
Tag local build image with registry
docker image tag custom-apache-image:latest 192.168.1.43:31300/admin/custom-apache:latest
List images to see registry image tag
manish@docker-lab:~/custom-apache-image$ docker images
i Info → U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
192.168.1.43:31300/admin/custom-apache:latest a14d53dfe52e 175MB 45.2MB
custom-apache-image:latest a14d53dfe52e 175MB 45.2MB
hello-world:latest f7931603f70e 20.3kB 3.96kB U
Push image on Gitea registry
docker image push 192.168.1.43:31300/admin/custom-apache:latest
The push refers to repository [192.168.1.43:31300/admin/custom-apache]
4f4fb700ef54: Mounted from admin/myapache
87a14f083967: Mounted from admin/myapache
9cd0271fa751: Mounted from admin/myapache
5b4d5959fc75: Mounted from admin/myapache
3adb6c39011e: Pushed
bea7747010c2: Mounted from admin/myapache
0e4bc2bd6656: Mounted from admin/myapache
4742a9e996d1: Mounted from admin/myapache
52836d624a58: Mounted from admin/myapache
latest: digest: sha256:a14d53dfe52e16ce848a5f3057bfa62425c495b8b7c02e69a6429c067a863f4f size: 856
List container packages on gitea
curl -uadmin:xxxxx -X GET http://192.168.1.43:31300/v2/_catalog
{"repositories":["admin/custom-apache"]}
Use image from gitea private registry
docker pull 192.168.1.43:31300/admin/custom-apache:latest
latest: Pulling from admin/custom-apache
bea7747010c2: Pull complete
52836d624a58: Pull complete
Digest: sha256:a14d53dfe52e16ce848a5f3057bfa62425c495b8b7c02e69a6429c067a863f4f
Status: Downloaded newer image for 192.168.1.43:31300/admin/custom-apache:latest
192.168.1.43:31300/admin/custom-apache:latest