跳转到内容

Containers and Kubernetes

此内容尚不支持你的语言。

The Containers tool window shows the containers, images, networks and volumes of a Docker or Podman engine, the Compose services of your project, and the workloads of a Kubernetes namespace. From it you read logs, open a shell inside a container or pod, and forward ports to your browser. The Containers window is Experimental; opening a container or pod as a project host is In progress.

  • An engine Ferris IDEA can reach. It speaks the Docker Engine API itself, so no Docker CLI is needed. It looks at DOCKER_HOST, then the Docker CLI’s current context, then the sockets of Docker Desktop, Colima, OrbStack, Rancher Desktop, a Podman machine and /var/run/docker.sock, plus each Lima instance. An engine on another machine is reached with ssh://user@host in DOCKER_HOST or a Docker context; each request then goes through your system ssh with the same post-quantum rule as every other SSH connection.
  • kubectl on your PATH for Kubernetes. Your kubeconfig, its credentials and exec plugins are used unchanged; no credential passes through Ferris IDEA.
  1. Open View › Tool Windows › Containers. Docker comes first, Kubernetes below; F5 reads again. While the window is shown it follows the engine’s events, so new and stopped containers appear without a refresh.
  2. The tree groups the engine into a Compose project with its services, other Compose groups, Containers, Images, Networks and Volumes. ← and → fold and unfold a section.
  3. Select a container and press a key, or open the context menu with a secondary click:
Key On a container
Enter or l Logs: the output, followed live with time stamps (up to 20 000 lines kept); ⌘S in the pane saves it to a file in the project
i Details: image, command, environment, ports, mounts; values of secret-looking names are masked
t Processes inside the container
b Files: browse the container’s folders and read a file as text
e Shell: a terminal tab Exec: <name> inside the container
s, x, r, z Start, stop, restart, pause or unpause
o Open the first published port in the browser
Delete twice Remove the container

On a section heading, Delete names what a prune would remove before anything goes; on the Images heading, p pulls an image by its full reference. With more than one engine, e on a heading switches to the next one.

When the project folder has compose.yaml (or compose.yml, docker-compose.yaml, docker-compose.yml), the window shows a group Compose: <project> (<file>) with each service and the state of its containers.

  • u on the project row starts all services (up --detach); d stops and removes them (down; volumes and images stay).
  • u on a service starts just that service; + scales it to a number of containers.
  • F4 on a service opens the Compose file at its definition.

Compose runs through docker compose, or the standalone docker-compose when the plugin is missing; its output appears line by line in the pane.

The Kubernetes part shows the current context and namespace; c switches the context, n the namespace. Workloads, Network, Configuration (secrets list only their key names; values are never read), Storage, Custom Resources and Events each have a section.

Key On a Kubernetes object
Enter Logs
e Shell: a terminal tab Exec: <kind> <name> running kubectl exec -it
f Forward a port: kubectl port-forward on 127.0.0.1; o opens it
r Restart: kubectl rollout restart, or delete a pod so its controller replaces it
y, k The object as YAML (secret values masked), or kubectl describe
g on a pod, twice A debug container: kubectl debug with a pinned busybox:1.36.1 image; the first press says that it stays in the pod until the pod is deleted

Port forwards belong to the running Ferris IDEA: the window and agents see the same list, and all of them stop when Ferris IDEA quits.

In progress A folder inside a running container or pod can open as a remote project, with the backend running inside it. In File › Remote Development…, type the host string and the folder separated by a space:

Host string Reaches
docker://<container> /app a Docker container, through docker exec
podman://<container> /app a Podman container, through podman exec
k8s://<namespace>/<pod> /app a pod’s first container, through kubectl exec
k8s://<namespace>/<pod>/<container> /app a named container of the pod
k8s://<context>/<namespace>/<pod>/<container> /app the same in another context (a context name must contain :, as cluster ARNs do)

These channels use the access you already have to the engine or cluster; no port is opened on either side. The container needs a POSIX shell (sh), and Ferris IDEA needs a backend build for the container’s system and processor next to the program (backends/ or FERRIS_IDEA_BACKENDS_DIR). This has been tested with a stand-in docker program in the test suite; a run against a real engine and cluster from the window is still open.

Not planned for now: Ferris IDEA does not read devcontainer.json, build an image from it or start a container for you. Start the container yourself (for example with Compose above) and open its folder with docker://.

What you see What it means
No engine listed None of the sockets above exists and DOCKER_HOST is not set. Start your engine.
TLS is not supported yet on an engine An engine that needs TLS (DOCKER_TLS_VERIFY, a context with TLS material) is listed but not contacted. Reach it over ssh:// instead.
A warning on a tcp:// engine A tcp:// engine on another machine is used, but the connection is neither encrypted nor authenticated. Prefer ssh://.
kubectl calls end after 20 s Each call has a 20-second limit; check kubectl get pods in a terminal with the same context.
A container host string is refused Each part may hold only letters, digits, ., _ and -, and may not start with -.

Every change (start, stop, remove, prune, exec, forward, Compose up and down) defaults to a dry run that reports what would happen, and needs the right run that you grant; changes are logged in .ferris-idea/agent-log.jsonl. docker_exec and kubernetes_exec take an argument list, never a shell line.

  • docker_composechangesdry run by defaultrunDocker Compose of the project folder (compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml plus override): services returns the files, project name and each service with the state of its containers; logs the last output lines of a service's containers; up (up --detach), down (whole project: containers and networks removed, volumes and images kept; with service: rm --stop --force of that service) and scale (service, replicas 0–20: up --detach --no-recreate --scale; a preview names the containers a scale-down removes) run the Compose CLI (docker compose or docker-compose) against the engine.
  • docker_containerchangesdry run by defaultrunOne Docker container: logs (tail, since, pattern with case_sensitive/whole_word/regex: matching lines and count), inspect (env, ports, mounts, labels, inspect JSON; secrets masked), top (processes); files (path, default /) and read_file (path, first 256 KiB) read inside the running container and need the run right; start, stop (10 s grace), restart, remove (also when running), pause, unpause default to dry_run=true; dry_run=false needs the run right and is logged in .ferris-idea/agent-log.jsonl.
  • docker_execchangesdry run by defaultrunRuns one command (an argument list, no host shell) inside a running Docker container without a TTY and returns stdout and stderr in order, the exit code and whether output was cut at 1 MiB.
  • docker_imagechangesdry run by defaultrunOne Docker image: pull (digest; warns on no tag or latest), remove (refused while a container uses it), inspect (id, tags, size, platform, users).
  • docker_networkchangesdry run by defaultrunDocker networks: list (name, driver, scope, built_in, attached containers), inspect (subnets, gateways, containers with addresses, labels; secrets masked, plus the inspect JSON), remove (refused for bridge/host/none and while containers are attached, without asking the engine).
  • docker_prunechangesdry run by defaultrunPrune one kind of Docker object: kind containers (stopped, outside Compose projects), images (untagged, unused), networks (not built in, no containers) or volumes (anonymous and unused; named volumes never).
  • docker_statusreadsDocker as the Containers window shows it, through the Engine API (no Docker CLI needed): the engines Ferris IDEA knows (DOCKER_HOST, Docker CLI contexts, Docker Desktop/Colima/OrbStack/Rancher Desktop/Podman/Lima sockets; ssh:// engines through the system ssh) with the one used, its version and host, containers (name, image, state, status, published ports, compose project and service; running first) and images (tags, short id, size).
  • docker_volumechangesdry run by defaultrunDocker volumes: list (name, driver, anonymous, containers that mount it), inspect (driver, mount point, scope, created, users, labels; plus the inspect JSON), remove (refused while a container mounts it, without asking the engine).
  • kubernetes_debugchangesdry run by defaultrunRuns one command in a new ephemeral debug container of a pod (kubectl debug --profile=general, output read from its logs once it ended), sharing the process namespace of target (default: the pod's first container); image defaults to the pinned busybox:1.36.1.
  • kubernetes_execchangesdry run by defaultrunRuns one command (an argument list) in a Kubernetes pod or in a pod of a Deployment, StatefulSet, DaemonSet or Job through kubectl exec without a TTY: output (stdout, then stderr), exit code, whether output was cut at 1 MiB.
  • kubernetes_objectreadsOne Kubernetes object through kubectl: yaml (read as JSON, written as YAML; secret data, a secret's last-applied annotation and secret-looking env values masked) or describe (kubectl describe with secret-looking NAME: value lines masked).
  • kubernetes_port_forwardchangesdry run by defaultrunKubernetes port forwards owned by this Ferris IDEA process, shared with the Containers window: list; start runs kubectl port-forward <kind>/<name> <local>:<remote> --address 127.0.0.1 for a Pod, Service, Deployment, StatefulSet or DaemonSet (remote_port defaults to the object's first TCP port, local_port to the same number when free and >= 1024, else a free one) and waits for kubectl's forwarding line; stop ends forward id.
  • kubernetes_resourcesreadsOne section of the Kubernetes tree through kubectl: workloads (deployments, stateful/daemon/replica sets, replication controllers, jobs, cron jobs, pods), network (services, ingresses, network policies), configuration (config maps with key counts; secrets with type and key names only, values never read), storage (claims, persistent volumes, storage classes), crds, events (last 100, newest first).
  • kubernetes_statusreadsKubernetes through kubectl (the user's kubeconfig and credentials): the contexts, the namespaces of the chosen context, and its workloads and services in the namespace (kind, name, status, ready count, restarts, age, images or ports).
  • kubernetes_workloadchangesdry run by defaultrunOne Kubernetes workload through kubectl: logs returns the last output lines of all its containers; restart runs kubectl rollout restart (Deployment, StatefulSet, DaemonSet) or deletes the pod so its controller replaces it.