Portainer Explorer (Unofficial)
Manage the Docker containers of your Portainer server without leaving VS Code.
Community extension. Not made by, affiliated with or endorsed by Portainer.io.
Features
- Log in with a Portainer access token (recommended) or a username and password.
Credentials are kept in VS Code's SecretStorage (your OS keychain), and an expired session logs in again by itself.
- Environments → stacks → containers in the activity bar, with live state
(green running, yellow paused, red stopped) and auto refresh.
- Container actions: start, stop, restart, pause / resume, kill, remove. Select several containers
(Ctrl/Shift+click) to act on all of them at once.
- Stack actions: start, stop or restart every container of a Compose / Swarm stack.
- Open Shell: a terminal inside a running container, like
docker exec -it or Portainer's Console.
Starts bash when the image has it, sh otherwise. Run any command there, including database clients:
psql -U postgres, mysql -u root -p, mongosh, redis-cli…
- Run Command in Container…: runs one command line directly, e.g.
psql -U postgres -d mydb, and remembers the last one.
- Logs: follows a container's logs in a terminal, like
docker logs -f, with stderr in red. Ctrl+C stops following.
- Inspect: opens the container's full
docker inspect JSON in an editor.
- Open in Portainer, Copy Container ID.
- Every container command also works from the Command Palette (
Portainer: Restart Container…): pick
the containers from a list.
Docker environments (standalone, agent, edge) are supported. Kubernetes environments are listed but not browsable yet.
Getting started
- Click the Portainer icon in the activity bar, then Log In.
- Enter your server's address, e.g.
https://portainer.example.com:9443.
- Sign in with an access token, or with a username and password.
Access token: in Portainer, open My account → Access tokens → Add access token. It starts with ptr_.
Accounts that sign in through OAuth / SSO must use a token: Portainer only accepts passwords for internal and LDAP users.
Self-signed certificate: Portainer's port 9443 uses one by default. The login offers to accept it.
Permissions and safety
The extension can only do what your Portainer user is allowed to do. If Portainer doesn't give you the Console,
Open Shell is refused too. A shell in a database container is full access to that database: mind which container you open.
Settings
| Setting |
Default |
|
portainer.allowSelfSignedCertificates |
false |
Accept untrusted TLS certificates. |
portainer.autoRefreshSeconds |
15 |
Refresh interval while the view is visible. 0 turns it off. |
portainer.groupByStack |
true |
Group containers by Compose / Swarm stack. |
portainer.logs.tail |
200 |
Past lines shown before following. 0 shows the whole log. |
portainer.logs.timestamps |
false |
Prefix log lines with their timestamp. |
portainer.shell.command |
(empty) |
Command started by Open Shell. Empty: bash, or sh when bash is missing. |
portainer.shell.user |
(empty) |
User for Open Shell and Run Command, e.g. root. Empty: the container's default user. |
Development
npm install
Open this folder in VS Code and press F5 to start a second window with the extension loaded.
npm run package builds the .vsix.
| File |
Role |
src/portainerClient.ts |
Portainer REST client (auth, environments, Docker proxy, log stream, exec websocket). No vscode import. |
src/session.ts |
Login prompts, SecretStorage, portainer.loggedIn context key. |
src/tree.ts |
Tree view: environments, stacks, containers. |
src/logs.ts |
Terminal that follows container logs. |
src/shell.ts |
Terminal running inside a container (Open Shell, Run Command). |
src/extension.ts |
Command registration, multi-select actions, container picker, auto refresh. |
| |