Getting the commit-id from the current release from inside of service/docker

Hi everyone,
in order to document measured data well, I need to get the commit-id from inside of the container. The container name and fleet are available as environment variables, unfortunately not the commit id. Anybody has any idea how to get the commit?
Best
Arne

Hi there, I’d probably recommend using the supervisor API to talk to the supervisor from within your container and fetch the commit it. This can be done like so: Interacting with the balena Supervisor - Balena Documentation

e.g

$ curl -X GET --header "Content-Type:application/json" \
   "$BALENA_SUPERVISOR_ADDRESS/v1/device?apikey=$BALENA_SUPERVISOR_API_KEY"

Keep in mind that interacting with the supervisor from inside the container will require the io.balena.features.supervisor-api label to be set in your docker-compose.yml file for the container:

labels:
      io.balena.features.supervisor-api: '1'