# Restarting different container from within another container on that device only via API

**URL:** <https://forums.balena.io/t/restarting-different-container-from-within-another-container-on-that-device-only-via-api/355528>\
**Category:** Product support\
**Created:** [April 4, 2022, 2:19pm UTC](https://forums.balena.io/t/restarting-different-container-from-within-another-container-on-that-device-only-via-api/355528 "2022-04-04T14:19:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard.galvez](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@richard.galvez](https://forums.balena.io/u/richard.galvez)\
**Post date:** [April 4, 2022, 2:19pm UTC](https://forums.balena.io/t/restarting-different-container-from-within-another-container-on-that-device-only-via-api/355528/1 "2022-04-04T14:19:29Z")

</div>

Hello,

I’m trying to figure out how to restart a container running on one device from another container using the supervisor API. The balena supervisor docs describe a restart endpoint that is a bit of overkill; it will restart the service on the entire fleet. I would like however only to restart the service on the device that the API call is being called from.

I can do this successfully using the balena-cloud API from within a container. This call will call out to balena cloud and command to restart the service, but requires connectivity out to the external endpoint, and then returns back to the local device. The API call is:

```auto
curl -X POST --header "Content-Type:application/json" --header "Authorization: Bearer $EXTERNAL_BALENA_API_TOKEN" --data '{ "uuid" : <device uuid>, "data" : { "serviceName" : <local-service-name> } }' "https://api.balena-cloud.com/supervisor/v2/applications/$BALENA_APP_ID/restart-service"

```

I’d like to just be able to do this from within the device itself.

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [April 6, 2022, 11:01am UTC](https://forums.balena.io/t/restarting-different-container-from-within-another-container-on-that-device-only-via-api/355528/2 "2022-04-06T11:01:30Z")

</div>

Hello @richard.galvez that’s a good question!

My recommendation is to use the supervisor API to reboot another container. Did you try this? [Interacting with the balena Supervisor - Balena Documentation](https://www.balena.io/docs/reference/supervisor/supervisor-api/#post-v1reboot)

You will need to have the `supervisor-api` label on your docker-compose → [Multiple containers - Balena Documentation](https://www.balena.io/docs/learn/develop/multicontainer/#labels)

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [April 6, 2022, 11:13am UTC](https://forums.balena.io/t/restarting-different-container-from-within-another-container-on-that-device-only-via-api/355528/6 "2022-04-06T11:13:02Z")

</div>

@richard.galvez i was wrong with the previous link.

To restart a service from one specific device using the supervisor API use this → [Interacting with the balena Supervisor - Balena Documentation](https://www.balena.io/docs/reference/supervisor/supervisor-api/#post-v2applicationsappidrestart-service)

```auto
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$BALENA_APP_ID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"serviceName": "my-service"}'

```

Let us know if that works!
