Push docker image directly to docker repository

we would like to use our locally built docker images to be used because building the docker image with the balena base image on the balena build server is not an option currently.
there seems to be a way to do this with the balena cli, but before installing a cli tool I would like to know if there are other options.

Is it possible to put the docker image in a git with the docker-compose.yml push that to the balena git repository and it will automatically generate a working balena docker image? (Please note, that the saved docker image will not be based on any of the balena base images.)
Thanks
Michael

Hi,

There is no requirement to use a Balena base-image; they are provided as a convenience for you if you wish. You can use the git push mechanism to push your code/docker files to our builder, where they will be built and registered to your application in our cloud docker-registry.

Does this help you at all?

Any chance to get this working with a locally built docker image (not a Dockerfile)
the image is available on hub.docker.com (although private)

You can use the balena-cli tool to balena push and include a --registry-secrets argument, pointing to a file with your Dockerhub credentials in it.

Or, if this is for development, you can export DOCKER_HOST variable to be tcp://ip.of.device:2375 if the device is a development image; this let’s you build on the device, or docker pull from dockerhub (after logging in)

Could you clarify why the cloud builder route is no possible, as it would help us to advise you better. Thanks.

we would like to use an existing docker image without any modifications.

The cloud builder is not an option right now because we would have to upload all our build files to your git repository and it is not clear who has access to this repository. Also all tests are performed on our docker image, if we let you build the image, we have to run all the tests twice.

ideally we would like to upload or push a docker-image, our config file (not the balena config) and a docker-compose-file.
The docker-compose file would have to mount the config file which is an xml file. The config file would be different for every device in the field. I am not sure yet, if this is the ideal set-up or even possible when using balena, but this is how we deploy our containers right now.

so I read through the cli documentation and found the balena deploy command.
The question now is, how to add the docker-compose.yml and our custom resource file.

So if you use balena push in a directory containing a docker-compose.yml having a service which references your image, and also a registry-secrets.yml with your dockerhub credentials, then this image will be pulled onto our backend, and pushed to your device untouched. This would get your service on the device.

Regarding the XML config file - you would have to make this a device-specific environment variable and have your entrypoint expand it into the filesystem.

thank you for the answers so far!

our xml config file is 1200 lines and it is signed. Storing this in an environment variable and expanding during launch will most likely break the signature.

Are there any other options to add device specific files? If so, please let me know.

You could base64 the file; this should keep its format when decoding - but I agree it wouldn’t be a very pretty process.