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.
-
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.
-
Since I was documenting what I was doing to debug errors, here's a short how-to for people who want to use the docker-registry app with authentication to build their own apps. Before submitting I realized that @girish already made a post here, but that was without the registry so I'm posting it either way
Prerequisites:
A machine that has both, docker and the cloudron cli installed and of course one or two Cloudrons for the apps to build and/or install
Docker: https://docs.docker.com/engine/install/ubuntu/
Cloudron CLI: https://docs.cloudron.io/custom-apps/cli/How to build apps and push to your Docker-Registry
install the docker-registry app on a cloudron (if possible don't use a production server), e.g. docker.example.com (you might want to create a dedicated user to work with it). Add the URL and docker credentials to your target cloudron in Settings / Private Docker Registry
Optional: use the Cloudron Build Service
install the Build Service app, e.g. https://build.example.com, open the terminal or file manager of the app and enter your docker credentials in
/app/data/docker.json
. After those changes reboot the build service app to make sure the correct registry is in there. You can directly login to your build service (no trailing slash in the url! see https://docs.cloudron.io/apps/build-service/ for more information) via
$cloudron build --set-build-service
(enter https://build.example.com)clone any repo you want to build
$git clone https://git.cloudron.io/cloudron/lamp-app
cwd into the cloned git directory
$cd lamp-app/
With local build
login to the docker-registry with your credentials (as non root user you might need to use sudo when issuing docker commands)
$docker login docker.example.com
build the thing (use custom lamp-app:tags if you want specific tag names)
$docker build -t docker.example.com/lamp-app .
push to the registry - this does not work without logging in first
$docker push docker.example.com/lamp-app
install on your target cloudron after logging in via
cloudron login
$cloudron install --image docker.example.com/lamp-app
With the Build Service
If you're using the build service, you can just run
$cloudron build
and enter your docker-repo (e.g.docker.example.com/lamp-app
)
and after logging in to your cloudron
$cloudron install --image docker.example.com/lamp-app
If you updated an app, you can use
cloudron update
to push a new version for an existing app.Cheers, M
@msbt
🦾
+1
-
Since I was documenting what I was doing to debug errors, here's a short how-to for people who want to use the docker-registry app with authentication to build their own apps. Before submitting I realized that @girish already made a post here, but that was without the registry so I'm posting it either way
Prerequisites:
A machine that has both, docker and the cloudron cli installed and of course one or two Cloudrons for the apps to build and/or install
Docker: https://docs.docker.com/engine/install/ubuntu/
Cloudron CLI: https://docs.cloudron.io/custom-apps/cli/How to build apps and push to your Docker-Registry
install the docker-registry app on a cloudron (if possible don't use a production server), e.g. docker.example.com (you might want to create a dedicated user to work with it). Add the URL and docker credentials to your target cloudron in Settings / Private Docker Registry
Optional: use the Cloudron Build Service
install the Build Service app, e.g. https://build.example.com, open the terminal or file manager of the app and enter your docker credentials in
/app/data/docker.json
. After those changes reboot the build service app to make sure the correct registry is in there. You can directly login to your build service (no trailing slash in the url! see https://docs.cloudron.io/apps/build-service/ for more information) via
$cloudron build --set-build-service
(enter https://build.example.com)clone any repo you want to build
$git clone https://git.cloudron.io/cloudron/lamp-app
cwd into the cloned git directory
$cd lamp-app/
With local build
login to the docker-registry with your credentials (as non root user you might need to use sudo when issuing docker commands)
$docker login docker.example.com
build the thing (use custom lamp-app:tags if you want specific tag names)
$docker build -t docker.example.com/lamp-app .
push to the registry - this does not work without logging in first
$docker push docker.example.com/lamp-app
install on your target cloudron after logging in via
cloudron login
$cloudron install --image docker.example.com/lamp-app
With the Build Service
If you're using the build service, you can just run
$cloudron build
and enter your docker-repo (e.g.docker.example.com/lamp-app
)
and after logging in to your cloudron
$cloudron install --image docker.example.com/lamp-app
If you updated an app, you can use
cloudron update
to push a new version for an existing app.Cheers, M
@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
-
@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
@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).
- 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.
-
R rxlict referenced this topic on