Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. General Questions
  3. execute script to start docker container on start up

execute script to start docker container on start up

Scheduled Pinned Locked Moved Unsolved General Questions
4 Posts 2 Posters 1.5k Views 2 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.
  • kasarrowtecK Offline
    kasarrowtecK Offline
    kasarrowtec
    Contributor
    wrote on last edited by
    #1

    Hi,

    i am trying to execute a script that will start a docker container every time the VOXL is started.

    A lot of the suggestions for running a script on start up on linux like using crontab or systemd or rc.local is not available with this custom yocto build on the VOXL.

    Does anyone have the best way of doing this ?

    1 Reply Last reply
    0
    • kasarrowtecK Offline
      kasarrowtecK Offline
      kasarrowtec
      Contributor
      wrote on last edited by
      #2

      The most promising way seemed to be to make a service file in etc/systemd/system -

      [Unit]
      Description=Starts the mastervoxl docker container on startup.
      
      [Service]
      Type=simple
      ExecStart=/bin/bash /home/root/mastervoxl_init.sh
      
      [Install]
      WantedBy=multi-user.target
      

      and the script mastervoxl_init.sh being -

      #!/bin/bash
      echo 'initializing mastervoxl docker container'
      docker run -it mastervoxl /bin/bash
      
      1 Reply Last reply
      0
      • Alex KushleyevA Offline
        Alex KushleyevA Offline
        Alex Kushleyev
        ModalAI Team
        wrote on last edited by Alex Kushleyev
        #3

        systemd is available on VOXL, so you could go ahead and try using the service file and script you wrote. Did you try it? However, you need to make sure that the Docker service is running, so your service file should require the Docker service also running. Docker is started by systemd as well.

        1 Reply Last reply
        0
        • kasarrowtecK Offline
          kasarrowtecK Offline
          kasarrowtec
          Contributor
          wrote on last edited by
          #4

          So i managed to get it to work with the following service file and script file -

          [Unit]
          After=docker-autorun.service
          
          [Service]
          Type=simple
          ExecStart=/bin/bash /home/root/mastervoxl_init.sh
          
          [Install]
          WantedBy=multi-user.target
          
          #!/bin/bash
          echo 'initializing mastervoxl docker container'
          docker run --restart=always -i mastervoxl /bin/bash
          
          1 Reply Last reply
          0

          Reading along? Create a free ModalAI Forum account to join in.

          With an account you can reply, ask your own question, get an email when a ModalAI engineer answers, and mark the reply that solved it. Your place in each thread is saved between visits.

          Questions about VOXL, Flight Core, ESCs and ModalAI drones are answered here by the engineers who build them.

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          ModalAI
          Categories Recent Tags ModalAI.com Docs
          © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups