Portainer icon

Portainer

Work with Portainer API data to manage Docker

Container → Exec

AI-generated

Overview

This node operation allows executing a command inside a specified Docker container managed by Portainer. It is useful for running shell commands or scripts within a container environment without needing direct terminal access. For example, you can use it to inspect container internals, run maintenance scripts, or debug running containers.

Use Case Examples

  1. Execute '/bin/sh' to open a shell inside a container for interactive troubleshooting.
  2. Run a specific command like 'ls -la' inside a container to list directory contents.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the container is running.
Container ID The unique identifier of the container in which the command will be executed.
Exec Command The command string to execute inside the container, e.g., '/bin/sh' or 'ls -la'.
TTY Boolean flag indicating whether to allocate a pseudo-TTY for the command execution, useful for interactive commands.

Output

JSON

  • Id - The ID of the exec instance created in the container.

Dependencies

  • Requires Portainer API access with an API key credential configured.

Troubleshooting

  • Ensure the container ID and environment ID are correct and the container is running.
  • If the command fails, verify the command syntax and availability inside the container.
  • Check API key permissions to ensure exec operations are allowed.

Links

Discussion