# Inspect or edit a stack

From the menu select **Stacks** then select the stack you want to inspect or edit.

<figure><img src="https://679325054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMdgxA76kWxcRmwybM8Ft%2Fuploads%2FvVFVjmDN7bJCAbH1eMqm%2F2.40.0-stack-page.gif?alt=media&#x26;token=2d7d599a-ac1b-450e-a0a5-6ae74c846bd1" alt=""><figcaption></figcaption></figure>

From the **Stack details** section at the top of the page, you can stop, delete, [migrate the stack](https://docs.portainer.io/sts/user/docker/stacks/migrate) or [create a template from the stack](https://docs.portainer.io/sts/user/docker/stacks/template). If deployed from Git you can [detach the stack from the Git repository](#detach-from-git).

## Inspect a stack

### Docker Standalone / Podman

When using Docker Standalone or Podman, you can:

* View the containers that make up the stack.
* Check to see if they are running or stopped.
* Get access to logs.
* Inspect individual containers.
* View container statistics.
* Get access to the container's console.

You can also see the image update indicator for each container in the stack. To recheck the image update status for all containers in the stack you can click the reload button next to the search box, or to recheck a single container's image, click the image update indicator icon for that container.&#x20;

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/t7mJLTSPHtGJLkrmsQs0/2.20-stacks-edit-containers.png" alt=""><figcaption></figcaption></figure>

### Docker Swarm

When using Docker Swarm, you can:

* View the services that make up the stack, and the individual tasks that make up each service.
* Check to see if they are running or stopped.
* See how many replicas are running on each host.
* Get access to logs.
* Inspect individual services.
* View service statistics.
* Get access to the service's console.

You can also see the image update indicator for each service in the stack. To recheck the image update status for all services in the stack you can click the Reload image indicators button, or to recheck a single service's image, click the image update indicator icon for that service.&#x20;

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/rT2qgx18wGboG4rXBotd/2.20-stacks-edit-services.png" alt=""><figcaption></figcaption></figure>

## Edit a stack

### Edit a stack deployed from Git

<figure><img src="https://679325054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMdgxA76kWxcRmwybM8Ft%2Fuploads%2F3y8dG5D2c5at8QM38fZ3%2F2.40.0-stack-details-1.png?alt=media&#x26;token=16971bd9-80a4-4f7d-b0cd-f7af00eabbbd" alt=""><figcaption></figcaption></figure>

#### Edit Git settings

If the stack was deployed from a Git repository, you can select **Edit Git settings** from the bottom of the Stack details view, allowing you to:

* Edit the [Git repository details](https://docs.portainer.io/sts/user/docker/add#option-3-git-repository).
* Configure [GitOps updates](https://docs.portainer.io/sts/user/docker/add#gitops-updates) or manually pull and redeploy the stack.
* View and edit the stack's environment variables.

Check **Redeploy** if you would like the stack to redeploy on saving. Click **Save settings** when you are done.

<figure><img src="https://679325054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMdgxA76kWxcRmwybM8Ft%2Fuploads%2FQE6xAvbNdUS7Vz9Xfiui%2F2.40.0-Edit-Git-settings-view.png?alt=media&#x26;token=198b5e67-f927-4501-9ddc-0fa9110b2a8a" alt=""><figcaption></figcaption></figure>

#### Detach from Git

If your stack was created from a Git repository, you have the option to detach the stack from the repository. This means you can edit the stack directly within Portainer, but it does mean that the stack can't be updated from Git anymore. This action also cannot be reversed.

{% hint style="info" %}
Detaching downloads the main compose file for the stack and stores it in Portainer. It does not download any additional compose files or `.env` files that may be contained within the repository.
{% endhint %}

Click **Detach from Git** to detach. You will be asked to confirm the action - click **Detach** to do so.

### Edit a stack deployed using the Web Editor or uploaded

If the stack was deployed using the [Web Editor](https://docs.portainer.io/sts/user/docker/add#option-1-web-editor) or [uploaded](https://docs.portainer.io/sts/user/docker/add#option-2-upload), you will have the option to edit your compose file manually, allowing you to make changes to the configuration and redeploy those changes.&#x20;

To edit a stack, from the menu select **Stacks**, select the stack you want to edit, then select the **Editor** tab.

{% hint style="info" %}
The Editor tab is only available for stacks that were deployed using the [Web Editor](https://docs.portainer.io/sts/user/docker/add#option-1-web-editor). For stacks deployed from a Git repository, the compose file must be edited in the repository itself.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/91u5suaIDSeBhczixv2w/2.19-stacks-edit-webeditor.png" alt=""><figcaption></figcaption></figure>

Here, you can edit the Compose file for the stack to suit your needs. Using the **Version** dropdown you can also select a previous version of your stack file (if one exists) to switch back to if required. Selecting a different version from the dropdown will replace the contents of the editor with that of the selected version.&#x20;

{% hint style="info" %}
You can search within the web editor at any time by pressing `Ctrl-F` (or `Cmd-F` on Mac).
{% endhint %}

In this section you can expand the Environment variables section to view and make changes to the stack's environment variables.

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/LaSkYf2xmPKfmkVr94ZA/2.20-stacks-edit-envvars.png" alt=""><figcaption></figcaption></figure>

You can also toggle the stack [webhook](https://docs.portainer.io/sts/user/docker/stacks/webhooks) and retrieve the webhook URL:&#x20;

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/qlhPVTWLcA3dy9GJzt6b/2.20-stacks-edit-webhook.png" alt=""><figcaption></figcaption></figure>

You can choose to **Prune services** if you have made changes that remove some services from the stack.

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/PEZCObmXNStghY82hR0N/2.20-stacks-edit-swarm-prune.png" alt=""><figcaption></figcaption></figure>

When you have finished making changes, click **Update the stack**.
