Is there a way to pull and run docker images?

Hi. I’m trying hard to understand how this works. I’ve installed balenaOS on a RasPi zero 2 W and i’ve read carefully the " Get Started with balenaCloud" documentation but i can’t figure out.
What i’m trying to do is to pull a docker public image and run it. Is it possible somehow?

Hi Sakis,
So if you’ve installed the image onthe rpi, when you reboot - as long as you have your wifi details setup correctly, or if you are using ethernet - you should see your ‘device’ populate the balena-dashboard.
if you now want to do a ‘docker run’ you have some options :

balena ssh ‘fleet name’ > then ‘balena run …’ instead of docker run.

other method is to create a dockerfile in a directory and push that to your fleet using ‘balena push ‘fleet’’

ultimately, you need to be logged into your device to run balena/docker run.
you can also do this via the terminal option on the dashboard by logging into the HOST.

i hope this helps.

kindly,

puc.

1 Like

Oh my god, that’s exactly what i was looking for. Thank you so much Puccaso, now it’s all clear to me. It was all about “balena run” and using terminal on dashboard that i was searching for.
Two more questions please if you don’t mind.

  1. As i understand, if i want to run multiple docker images, i just open multiple terminals and that’s it?
  2. If i reboot the device, is there an option somehow to run the docker images automatically when the device boots?

Hey Sakis,

Happy this will help you friend. Balena has a dope community and we’re all waiting for Balena to drop their prices :smiley: in the meantime, we’re all here to help hehe…

so regarding your other questions:

  1. if you want to run multiple docker images -
    once you have run the ‘balena run …’ command, that will run in the background.
    you can see your processes as you would on docker, with balena ps (-a) etc…
    if you wanted to run something else, you could just run ‘balena run …’ again with another command line…

if you want to do this in a more balena-esque way, you can create the docker relevant assets on your local machine and then push them to the fleet…

you could do something like

mkdir -p ./repo/{app1,app2}
echo "FROM alpine:latest" > ./repo/app1/Dockerfile
echo "FROM ubuntu:latest" > ./repo/app2/Dockerfile

then, save following as a docker-compose.yml in ./repo/

version: "2.4"

services:
  app1:
    build: ./repo/app1
    restart: unless-stopped
    volumes:
      - app1:/app/data 

  app2:
    build: ./repo/app2
    restart: unless-stopped
    volumes:
      - app2:/app/data 

volume:
  app1:
  app2:

then you would do a ‘balena push [fleet]’ from your local maachine.
this will upload your code to balena servers, compile it, and redownload a ready image back on your device.

happy balenaying =]

puc

3 Likes

You describe everything perfectly and easy to understand. I really appreciate your time to help me, i almost gave up. Now i understand the amazing potential of the balenaOS. Have a great day/night Puc! :smiley:

1 Like