# Restart a container

> Restart an app’s container or Compose service from Pulse. The feature is off by default. You turn it on at the server, and each restart asks for your confirmation.

- Section: Servers and providers
- Availability: With Pulse Agent, from the Free plan. On iPhone, iPad, Mac and Android.
- URL: https://pulse-app.si/en/docs/servers/agent-restart

Only two actions exist, the equivalents of `docker restart <container>` and `docker compose restart <service>`. [Pulse Agent](https://pulse-app.si/en/docs/servers/agent) must already be running on the server.

## Turn it on at the server

The app can’t turn restarts on. They need a setting on the server.

1. In the Compose `.env`, add `PULSE_AGENT_ACTIONS=1`.
2. Add the lines below to your `docker-compose.yml`. They create a second proxy that allows restarts only, and the first stays read-only.
3. Run `docker compose up -d`.

**docker-compose.yml**

```yaml
services:
  pulse-agent:
    environment:
      PULSE_AGENT_ACTIONS: ${PULSE_AGENT_ACTIONS:-0}
      PULSE_ACTIONS_DOCKER_HOST: tcp://pulse-restart-proxy:2375
    depends_on: [pulse-socket-proxy, pulse-restart-proxy]

  pulse-restart-proxy:
    image: tecnativa/docker-socket-proxy:v0.5.0
    restart: unless-stopped
    environment:
      POST: 1
      ALLOW_RESTARTS: 1
      DISABLE_IPV6: 1
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks: [pulse-socket]
```

> **Keep two proxies**
>
> In `tecnativa/docker-socket-proxy`, `POST: 1` opens writes on every allowed section. With `CONTAINERS: 1` on the same proxy, it would also let anyone create a container or run a command in one.

## Link an app to its target

1. Open the app, then **App Settings**.
2. Under **Restart**, open **Container or Service**.
3. Choose under **Compose Services** or **Containers**. The list comes from the agent’s latest report.

The app must be attached to the server, and you must be able to manage that server. Sharing an app gives no control over the other containers.

## Restart

1. On the app’s page, in the **Restart** card, choose **Restart**.
2. Confirm. The app will be unavailable for a few seconds.
3. Authenticate, then follow the status in the card until **Restarted at …**.

Authentication is Face ID, Touch ID or the passcode on iPhone and iPad, Touch ID or the password on Mac, and fingerprint or code on Android. A restart is refused on a locked device, even when started by Siri or Shortcuts. Each restart is recorded in the card’s **History**, with its source.

## How the command arrives, with no open port

1. With each report, the agent says whether restarts are on. If a report doesn’t say, Pulse treats them as off.
2. The agent asks every 15 seconds if there’s a command. A command not picked up within 2 minutes expires.
3. It checks the name, restarts the target, then returns the result, which is either success or a short code, never Docker’s raw text.

> **With a Pulse Relay**
>
> Commands go only through `api.pulse-app.si`. Behind a [Pulse Relay](https://pulse-app.si/en/docs/team/relay), leave `PULSE_AGENT_ACTIONS` at `0`.

## If it doesn’t work

| Message in the app | What to do |
| --- | --- |
| Install Pulse Agent on this app’s server to be able to restart it. | [Install Pulse Agent](https://pulse-app.si/en/docs/servers/agent#install). |
| Restarts are off on this server: add PULSE_AGENT_ACTIONS=1 to Pulse Agent’s .env. | Check the `.env` and that the variable reaches the agent, then `docker compose up -d`. |
| Pulse Agent has stopped reporting on this server. | No report for 15 minutes. Check `docker compose logs pulse-agent`. |
| Docker refused: the restart proxy is missing on the server. | `PULSE_ACTIONS_DOCKER_HOST` is missing or points to the read-only proxy, or the proxy lacks `POST: 1` and `ALLOW_RESTARTS: 1`. |
| Not found on the server: choose the target again in the settings. | The container changed name, or the service no longer has a container. |
| Pulse Agent didn’t pick up the command in time. | The agent has stopped picking up commands. Check `docker compose logs pulse-agent`. |

In the agent’s logs, `PULSE_AGENT_ACTIONS ignored` means `DOCKER_HOST` is missing, and restarts need it.

- [Pulse Agent](https://pulse-app.si/en/docs/servers/agent): Installing and securing the probe.
- [Siri and Shortcuts](https://pulse-app.si/en/docs/ask/siri): Start a restart by voice.
