Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. How to build (custom) apps using the docker-registry

How to build (custom) apps using the docker-registry

Scheduled Pinned Locked Moved App Packaging & Development
build servicecustom appsdockerregistrytutorial
24 Posts 8 Posters 3.9k Views 10 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kallados
    wrote on last edited by kallados
    #13

    I can't get it 😕 I can build everything is fine. But i can't push it to Docker Registry UI.

    Cloudron Build Service: https://builder.kallados.com
    Docker Registry UI: https://docker.kallados.com

    Git with Original Base Image from Cloudron: https://gitea.kallados.com/root/shortener

    Building - OK

    root@v220201270340137003:~/shortener# cloudron build --set-build-service
    Enter build service URL: builder.kallados.com        
    Using build service https://builder.kallados.com
    Building kallados/shortener:20210214-180129-524065527
    Uploading source tarball...
    Build Service login (https://builder.kallados.com):
    Username: kallados
    Password: ****************************
    Login successful.
    
    .....
    Compiled successfully.
    
    

    Push - NOK

    Successfully built 40310b79e0c2
    Successfully tagged kallados/shortener:20210214-180518-5970157a5
    The push refers to repository [docker.io/kallados/shortener]
    
    

    For some reason... he want to push just in docker.io and not docker.kallados.com

    But my docker.json on Builder App is fine...

    {
      "docker.kallados.com": {
        "username": "kallados",
        "password": "xxx"
      }
    }
    

    I tested few times -> cloudron build --set-repository

    But get error (Builder LOG)

    Feb 14 19:11:45 build-1613326304870 Building...
    Feb 14 19:11:45 build-1613326304870 docker build -t docker.kallados.com/kallados/life.gd.shortener:20210214-181144-759ce076f (Dockerfile)
    Feb 14 19:11:45 build-1613326304870 Build stream finished
    Feb 14 19:11:45 build-1613326304870 Pushing...
    Feb 14 19:12:15 build-1613326304870 has status running. Logs at /tmp/build-1613326304870.log
    Feb 14 19:12:35 build-1613326304870 Push stream finished
    Feb 14 19:12:35 build-1613326304870 received unexpected HTTP status: 200 OK
    Feb 14 19:12:35 build-1613326304870 Push failed
    Feb 14 19:12:35 ERROR Build build-1613326304870 failed during image pushing. [ /app/code/src/builds.js:142:25 ]
    

    Maybe is something wrong with my Repository Adress, because this here not working 😞

    root@v220201270340137003:~/shortener# cloudron build --set-repository
    Enter repository (e.g registry/username/it.kutt.cloudronapp): docker.kallados.com/kallados/life.gd.shortener
    

    Thanks for your support guys

    M 1 Reply Last reply
    0
    • K kallados

      I can't get it 😕 I can build everything is fine. But i can't push it to Docker Registry UI.

      Cloudron Build Service: https://builder.kallados.com
      Docker Registry UI: https://docker.kallados.com

      Git with Original Base Image from Cloudron: https://gitea.kallados.com/root/shortener

      Building - OK

      root@v220201270340137003:~/shortener# cloudron build --set-build-service
      Enter build service URL: builder.kallados.com        
      Using build service https://builder.kallados.com
      Building kallados/shortener:20210214-180129-524065527
      Uploading source tarball...
      Build Service login (https://builder.kallados.com):
      Username: kallados
      Password: ****************************
      Login successful.
      
      .....
      Compiled successfully.
      
      

      Push - NOK

      Successfully built 40310b79e0c2
      Successfully tagged kallados/shortener:20210214-180518-5970157a5
      The push refers to repository [docker.io/kallados/shortener]
      
      

      For some reason... he want to push just in docker.io and not docker.kallados.com

      But my docker.json on Builder App is fine...

      {
        "docker.kallados.com": {
          "username": "kallados",
          "password": "xxx"
        }
      }
      

      I tested few times -> cloudron build --set-repository

      But get error (Builder LOG)

      Feb 14 19:11:45 build-1613326304870 Building...
      Feb 14 19:11:45 build-1613326304870 docker build -t docker.kallados.com/kallados/life.gd.shortener:20210214-181144-759ce076f (Dockerfile)
      Feb 14 19:11:45 build-1613326304870 Build stream finished
      Feb 14 19:11:45 build-1613326304870 Pushing...
      Feb 14 19:12:15 build-1613326304870 has status running. Logs at /tmp/build-1613326304870.log
      Feb 14 19:12:35 build-1613326304870 Push stream finished
      Feb 14 19:12:35 build-1613326304870 received unexpected HTTP status: 200 OK
      Feb 14 19:12:35 build-1613326304870 Push failed
      Feb 14 19:12:35 ERROR Build build-1613326304870 failed during image pushing. [ /app/code/src/builds.js:142:25 ]
      

      Maybe is something wrong with my Repository Adress, because this here not working 😞

      root@v220201270340137003:~/shortener# cloudron build --set-repository
      Enter repository (e.g registry/username/it.kutt.cloudronapp): docker.kallados.com/kallados/life.gd.shortener
      

      Thanks for your support guys

      M Offline
      M Offline
      msbt
      App Dev
      wrote on last edited by
      #14

      @kallados did you also restart the build-app after setting the docker stuff?

      K 1 Reply Last reply
      0
      • M msbt

        @kallados did you also restart the build-app after setting the docker stuff?

        K Offline
        K Offline
        kallados
        wrote on last edited by
        #15
        This post is deleted!
        1 Reply Last reply
        0
        • robiR Offline
          robiR Offline
          robi
          wrote on last edited by
          #16

          does the cloudron npm need an update? what version is it?

          Conscious tech

          K 1 Reply Last reply
          0
          • robiR robi

            does the cloudron npm need an update? what version is it?

            K Offline
            K Offline
            kallados
            wrote on last edited by kallados
            #17

            @robi

            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 App

            Maybe 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.

            girishG 1 Reply Last reply
            0
            • robiR Offline
              robiR Offline
              robi
              wrote on last edited by robi
              #18

              docker.io is the default, unless overidden with a private registry.

              Conscious tech

              K 1 Reply Last reply
              0
              • robiR robi

                docker.io is the default, unless overidden with a private registry.

                K Offline
                K Offline
                kallados
                wrote on last edited by
                #19

                @robi My privat registry running on docker.kallados.com, unfortunately just with docker. I cab't use Builder for some Reason.

                1 Reply Last reply
                0
                • K kallados

                  @robi

                  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 App

                  Maybe 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.

                  girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by
                  #20

                  @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.

                  1 Reply Last reply
                  2
                  • M msbt

                    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

                    P Offline
                    P Offline
                    plusone-nick
                    wrote on last edited by
                    #21

                    @msbt 🙏🦾🙌+1

                    ✌💙+1

                    1 Reply Last reply
                    0
                    • M msbt

                      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

                      BrutalBirdieB Offline
                      BrutalBirdieB Offline
                      BrutalBirdie
                      Partner
                      wrote on last edited by BrutalBirdie
                      #22

                      @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
                      
                      

                      Like my work? Consider donating a drink. Cheers!

                      infogulchI 1 Reply Last reply
                      3
                      • BrutalBirdieB BrutalBirdie

                        @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
                        
                        
                        infogulchI Offline
                        infogulchI Offline
                        infogulch
                        wrote on last edited by
                        #23

                        @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).

                        BrutalBirdieB 1 Reply Last reply
                        2
                        • infogulchI infogulch

                          @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).

                          BrutalBirdieB Offline
                          BrutalBirdieB Offline
                          BrutalBirdie
                          Partner
                          wrote on last edited by
                          #24

                          @infogulch RTFM myself 😄 nice catch, thanks for that.

                          Like my work? Consider donating a drink. Cheers!

                          1 Reply Last reply
                          1
                          • rxlictR rxlict referenced this topic on
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Bookmarks
                          • Search