docs: document the command's starting directory
This commit is contained in:
@@ -91,6 +91,8 @@ ecr [OPTIONS] <DISTRO[:VERSION]> [-- COMMAND...]
|
|||||||
| `--kernel[=PATH]` | Boot with QEMU system emulation. Downloads Alpine's default kernel if no `=PATH` given (`linux-virt`, or `linux-lts` on riscv64 where the virt flavor is not built) |
|
| `--kernel[=PATH]` | Boot with QEMU system emulation. Downloads Alpine's default kernel if no `=PATH` given (`linux-virt`, or `linux-lts` on riscv64 where the virt flavor is not built) |
|
||||||
| `-m, --memory <SIZE>` | Memory for QEMU VM (default: 2G, only with `--kernel`) |
|
| `-m, --memory <SIZE>` | Memory for QEMU VM (default: 2G, only with `--kernel`) |
|
||||||
|
|
||||||
|
The command starts in the directory mapped from your current one: `/root/<name>` with the default `--bind`, `/mnt/<name>` with `--bind-rw`. With `--no-bind` (or when the current directory is not mapped) it starts in `/root`.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -101,6 +103,7 @@ ecr debian
|
|||||||
ecr alpine -- sh -c 'apk add curl && curl -s https://example.com'
|
ecr alpine -- sh -c 'apk add curl && curl -s https://example.com'
|
||||||
|
|
||||||
# Work on your project inside Ubuntu — changes are visible on the host
|
# Work on your project inside Ubuntu — changes are visible on the host
|
||||||
|
# (the shell starts in /mnt/myapp, where the project is mounted)
|
||||||
ecr ubuntu --bind-rw ~/projects/myapp
|
ecr ubuntu --bind-rw ~/projects/myapp
|
||||||
|
|
||||||
# Native-compile for ARM64 through emulation (requires QEMU binfmt_misc)
|
# Native-compile for ARM64 through emulation (requires QEMU binfmt_misc)
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ The CLI delegates to the library; the namespace-mode flow is:
|
|||||||
7. Set up mounts: /proc, /sys (ro), /dev, /dev/pts
|
7. Set up mounts: /proc, /sys (ro), /dev, /dev/pts
|
||||||
8. Apply bind targets: overlays (ro) and bind mounts (rw)
|
8. Apply bind targets: overlays (ro) and bind mounts (rw)
|
||||||
9. Write /etc/resolv.conf with DNS servers
|
9. Write /etc/resolv.conf with DNS servers
|
||||||
10. Set the working directory
|
10. Set the working directory to the target where the current directory is mapped (`/root/<basename>`, or `/mnt/<basename>` with `--bind-rw`); the library default applies when it is not mapped
|
||||||
11. Exec shell or command in chroot with the composed envp
|
11. Exec shell or command in chroot with the composed envp
|
||||||
12. On exit, clean up the temporary directory; propagate the exit code
|
12. On exit, clean up the temporary directory; propagate the exit code
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ The rootfs directory is converted to an uncompressed CPIO archive (newc format)
|
|||||||
|
|
||||||
### Overlay Mount (Default)
|
### Overlay Mount (Default)
|
||||||
|
|
||||||
By default, the current working directory is mounted as an overlay filesystem at `/root/<basename>` inside the chroot, where `<basename>` is the name of the current directory.
|
By default, the current working directory is mounted as an overlay filesystem at `/root/<basename>` inside the chroot, where `<basename>` is the name of the current directory. The command starts in that directory, so relative paths keep meaning what they meant on the host.
|
||||||
|
|
||||||
Overlay configuration:
|
Overlay configuration:
|
||||||
- `lowerdir`: the source directory (read-only)
|
- `lowerdir`: the source directory (read-only)
|
||||||
@@ -385,7 +385,7 @@ $ ecr ubuntu:noble -- make build
|
|||||||
|
|
||||||
### Read-Write Bind Mount
|
### Read-Write Bind Mount
|
||||||
|
|
||||||
`--bind-rw <path>` creates a true read-write bind mount at `/mnt/<basename>`. This modifies the host filesystem directly. Use with caution.
|
`--bind-rw <path>` creates a true read-write bind mount at `/mnt/<basename>`. This modifies the host filesystem directly. Use with caution. When the current directory is mounted this way, the command starts in `/mnt/<basename>`.
|
||||||
|
|
||||||
Multiple `--bind-rw` paths can be specified. If a path is specified in both `--bind` and `--bind-rw`, the read-write mount takes precedence.
|
Multiple `--bind-rw` paths can be specified. If a path is specified in both `--bind` and `--bind-rw`, the read-write mount takes precedence.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user