How to build (custom) apps using the docker-registry
-
6.14.4
where i run cloudron CLI and 7.5.4 on Cloudron Builder Server. Seems to be same problem here maybe.
https://forum.cloudron.io/topic/4459/cloudron-build-mess-up
Some Issue with Name with new Cloudron Registry UI AppMaybe is here some problem with Cloudron build and subdomain. My Repo is with subdomain docker.kallados.com
cloudron build --set-repository Enter repository (e.g registry/username/it.kutt.cloudronapp): docker.kallados.com/kallados/short
get Output:
Successfully tagged docker.kallados.com/kallados/short:20210214-211247-622543dc1 The push refers to repository [docker.kallados.com/kallados/short]
End error:
Feb 14 22:12:48 =========================================== Feb 14 22:12:48 Application Build Service Worker Feb 14 22:12:48 =========================================== Feb 14 22:12:48 Feb 14 22:12:48 Docker Username: kallados Feb 14 22:12:48 Build logfile: /tmp/build-1613337167754.log Feb 14 22:12:48 Build Id: build-1613337167754 Feb 14 22:12:48 Image Repo: docker.kallados.com/kallados/short Feb 14 22:12:48 Image Tag: 20210214-211247-622543dc1 Feb 14 22:12:48 Push: true Feb 14 22:12:48 Source Archive: /tmp/ZHo6Al3DzbPVKU5eUfGpUMN2.gz Feb 14 22:12:48 Use cache: true Feb 14 22:12:48 Dockerfile Name: Dockerfile Feb 14 22:12:48 Feb 14 22:12:48 =========================================== Feb 14 22:12:48 Feb 14 22:12:48 build-1613337167754 Building... Feb 14 22:12:48 build-1613337167754 docker build -t docker.kallados.com/kallados/short:20210214-211247-622543dc1 (Dockerfile) Feb 14 22:12:48 build-1613337167754 Build stream finished Feb 14 22:12:48 build-1613337167754 Pushing... Feb 14 22:13:18 build-1613337167754 has status running. Logs at /tmp/build-1613337167754.log Feb 14 22:13:38 build-1613337167754 Push stream finished Feb 14 22:13:38 build-1613337167754 received unexpected HTTP status: 200 OK Feb 14 22:13:38 build-1613337167754 Push failed Feb 14 22:13:38 ERROR Build build-1613337167754 failed during image pushing. [ /app/code/src/builds.js:142:25 ]
If i use just just
cloudron build --set-repository Enter repository (e.g registry/username/it.kutt.cloudronapp): kallados/shortener
get answer
Successfully tagged kallados/shortener:20210214-211904-2725dd144 The push refers to repository [docker.io/kallados/shortener]
But docker.io has been nowhere stored from me. docker.json on Builder is correct.
*** I have tried to enter a port. Interesting why IPv6 pops out... but at least I get response from the server.
Successfully built 40310b79e0c2 Successfully tagged gd.life:8000/kallados/short:20210214-221223-9816a45d7 The push refers to repository [gd.life:8000/kallados/short] Get https://gd.life:8000/v2/: dial tcp [xxx:3549::3]:8000: connect: no route to host Failed to build app. See log output above.
So i got it successfully and pushed into Registry on Cloudron. I had just to use Docker and not Cloudron Builder.
-
@kallados I think the issue you hit is that 6.1.2 has a bug where pushing from a custom docker client fails (in this case, the docker client is the build service). https://forum.cloudron.io/topic/4383/cannot-install-apps-from-docker-registry-because-authentication-fails/8 has the fix.
-
@msbt Nice guide!
There is something that I miss tho.
I like to run my cloudron apps local first so I can see if everything is working as intended.
This only works to a certain level for example this can't work if a database addon is used.
But everything before that step can be tested locally.A full local test suite would be awesome, so I the developer don't have to push every test and deploy it.
For example this is how I do some local testing before I push my image.
Needed software is
jq
for json parsing,docker
,bash
,sed
Script explained with words:
- Get the ID and version Tag from the
CloudronManifest.json
and use them for docker build. - Create local folders for
/tmp
/app/data
and/run
so I can emulate cloudrons readonly behavior. - Cleanup local folders so every test is fresh and clean
- Build the docker image with Data from
CloudronManifest.json
- Run the freshly build Image in readonly mode with local test folders and an interactive bash session so I can debug / test some stuff.
#!/bin/bash set -x ID=$(jq -r ".id" CloudronManifest.json) VERSION=$(jq -r ".version" CloudronManifest.json') echo "=> Create Test Data dir" mkdir -p ./cloudron_test/data ./cloudron_test/tmp ./cloudron_test/run echo "=> Cleanup Test Data" rm -rf ./cloudron_test/data/* ./cloudron_test/tmp/* ./cloudron_test/run/* echo "=> Build test image" docker build -t dr.cloudron.dev/$ID:$VERSION . echo "=> Run $VERSION tag of build image of $ID" docker run -ti --read-only \ --volume $(pwd)/cloudron_test/data:/app/data:rw \ --volume $(pwd)/cloudron_test/tmp:/tmp:rw \ --volume $(pwd)/cloudron_test/run:/run:rw \ dr.cloudron.dev/$ID:$VERSION \ bash
- Get the ID and version Tag from the
-
@brutalbirdie btw, you can get raw strings from jq directly without having to strip quotes with the
-r
option:ID=$(jq -r ".id" CloudronManifest.json) VERSION=$(jq -r ".version" CloudronManifest.json)
This does one better than just stripping quotes since it will also decode other escaped characters (not that that applies in this case).
-
@infogulch RTFM myself nice catch, thanks for that.
-