mirror of
https://github.com/tiennm99/composes.git
synced 2026-10-11 03:13:16 +00:00
fix(code-server): pass SERVICE_HOSTNAME as HOST so the zsh prompt shows the hostname
This commit is contained in:
1 parent
088579890a
commit
56b1c5f931
3 files changed
+10
-2
No files matched your search
@@ -10,6 +10,6 @@ PASSWORD=
|
||||
GIT_NAME=
|
||||
GIT_EMAIL=
|
||||
|
||||
# Container hostname, shown in the shell prompt.
|
||||
# Container hostname, also passed in as HOST -- the name zsh's prompt shows.
|
||||
# Not named HOSTNAME: the deploying shell's own HOSTNAME would override it.
|
||||
SERVICE_HOSTNAME=code-server
|
||||
@@ -98,7 +98,7 @@ new binary overwrites the old one.
|
||||
| --- | --- |
|
||||
| `PASSWORD` | Web UI login. Required. |
|
||||
| `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity |
|
||||
| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows |
|
||||
| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows (also passed as `HOST`) |
|
||||
|
||||
Generate a password with `openssl rand -base64 24`.
|
||||
|
||||
@@ -109,6 +109,13 @@ can only read from inside the container.
|
||||
The `coder` user has passwordless `sudo`, as the image sets it up. Anyone who
|
||||
can log in to the editor is root in the container.
|
||||
|
||||
`SERVICE_HOSTNAME` is used twice: as the container's `hostname:` and as the
|
||||
`HOST` variable inside it. Coolify injects `HOST=0.0.0.0` into every compose
|
||||
app, and zsh seeds `$HOST` and the `%m`/`%M` prompt escapes from that variable
|
||||
rather than calling `gethostname()`, so a zsh prompt reads `0`. code-server
|
||||
itself never reads `HOST`; it binds through `--bind-addr`. bash is unaffected;
|
||||
its `\h` uses the real hostname.
|
||||
|
||||
## Docker access
|
||||
|
||||
The host's Docker socket is bind-mounted at `/var/run/docker.sock`. The image
|
||||
|
||||
@@ -11,6 +11,7 @@ services:
|
||||
- GIT_AUTHOR_EMAIL=${GIT_EMAIL}
|
||||
- GIT_COMMITTER_NAME=${GIT_NAME}
|
||||
- GIT_COMMITTER_EMAIL=${GIT_EMAIL}
|
||||
- HOST=${SERVICE_HOSTNAME}
|
||||
volumes:
|
||||
- 'code-server-home:/home/coder'
|
||||
- 'code-server-workspace:/workspace'
|
||||
|
||||
Reference in new issue
Block a user