Return a new container snapshot, with a file added to its filesystem with text content Parameters ---------- path: Path of the new file. May be relative or absolute. Example: "README.md" or "/etc/profile" contents: Contents
(
self,
path: str,
contents: str,
*,
permissions: int | None = 420,
owner: str | None = "",
expand: bool | None = False,
)
| 3454 | return Container(_ctx) |
| 3455 | |
| 3456 | def with_new_file( |
| 3457 | self, |
| 3458 | path: str, |
| 3459 | contents: str, |
| 3460 | *, |
| 3461 | permissions: int | None = 420, |
| 3462 | owner: str | None = "", |
| 3463 | expand: bool | None = False, |
| 3464 | ) -> Self: |
| 3465 | """Return a new container snapshot, with a file added to its filesystem |
| 3466 | with text content |
| 3467 | |
| 3468 | Parameters |
| 3469 | ---------- |
| 3470 | path: |
| 3471 | Path of the new file. May be relative or absolute. Example: |
| 3472 | "README.md" or "/etc/profile" |
| 3473 | contents: |
| 3474 | Contents of the new file. Example: "Hello world!" |
| 3475 | permissions: |
| 3476 | Permissions of the new file. Example: 0600 |
| 3477 | owner: |
| 3478 | A user:group to set for the file. |
| 3479 | The user and group can either be an ID (1000:1000) or a name |
| 3480 | (foo:bar). |
| 3481 | If the group is omitted, it defaults to the same as the user. |
| 3482 | expand: |
| 3483 | Replace "${VAR}" or "$VAR" in the value of path according to the |
| 3484 | current environment variables defined in the container (e.g. |
| 3485 | "/$VAR/foo.txt"). |
| 3486 | """ |
| 3487 | _args = [ |
| 3488 | Arg("path", path), |
| 3489 | Arg("contents", contents), |
| 3490 | Arg("permissions", permissions, 420), |
| 3491 | Arg("owner", owner, ""), |
| 3492 | Arg("expand", expand, False), |
| 3493 | ] |
| 3494 | _ctx = self._select("withNewFile", _args) |
| 3495 | return Container(_ctx) |
| 3496 | |
| 3497 | def with_registry_auth( |
| 3498 | self, |