Docker icon

Docker

Manage Docker containers, images, networks, volumes, and daemon metadata with Unix socket, TCP, TLS, or SSH connections

Container → Replace Exact Text

AI-generated

Summary

Replace exact text in a target file inside a Docker container

Inputs

  • containerId (required) — Container name or full/short container ID
  • workingPath — Absolute path inside the container. Relative file paths resolve from here. Linux containers only.
  • filePath (required) — Absolute path, or a path relative to Working Path
  • oldText (required) — Exact UTF-8 text that must appear exactly once in the target file
  • newText — Replacement text to write when Old Text matches exactly once

Output shape

updated file content as a string

Returned only when the replacement succeeds; otherwise an error is thrown.

Examples

Example 1: Update a JSON configuration key in a container file

containerId: "my-app", workingPath: "/workspace", filePath: "app/config.json", oldText: "oldValue", newText: "newValue"

Example 2: Replace a line in a plain‑text config file

containerId: "cd17c922acd6", workingPath: "/workspace", filePath: "settings.env", oldText: "DEBUG=false", newText: "DEBUG=true"

Links

Discussion