https://github.com/balena-io-experimental/hostname
Utility block to set a device's hostname in balenaOS
https://github.com/balena-io-experimental/hostname
balena hostname hub
Last synced: 5 months ago
JSON representation
Utility block to set a device's hostname in balenaOS
- Host: GitHub
- URL: https://github.com/balena-io-experimental/hostname
- Owner: balena-io-experimental
- Created: 2021-07-20T19:20:57.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-25T15:54:36.000Z (over 3 years ago)
- Last Synced: 2024-01-27T02:42:52.740Z (over 1 year ago)
- Topics: balena, hostname, hub
- Language: Shell
- Homepage: https://hub.balena.io/blocks
- Size: 62.5 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# hostname
An utility block to set the hostname of devices running balenaOS.
**Disclaimer**: Setting the hostname on a device running balenaOS is as easy as hitting an API endpoint on the supervisor. This utility wraps the required http request into a prebuilt image that you can drop on your projects. It's clearly *NOT* the most efficient approach as the device needs to download and run an additional container. See our [documentation](https://www.balena.io/docs/reference/supervisor/supervisor-api/#patch-v1devicehost-config) for specifics on how to roll this into your own services.
## Usage
#### Prebuilt images
We maintain images for this block on balenaHub Container Registry. The images can be accessed using:
`bh.cr/g_tomas_migone1/hostname-` or `bhcr.io/g_tomas_migone1/hostname-` where `` is one of: `rpi`, `armv7hf`, `aarch64` or `amd64`.
For details on how to select a specific version or commit version of the image see our [documentation](https://github.com/balena-io/open-balena-registry-proxy/#usage).
#### docker-compose file
To use this image, create a container in your `docker-compose.yml` file and set the `SET_HOSTNAME` environment variable as shown below:```yaml
version: '2'services:
hostname:
image: bh.cr/g_tomas_migone1/hostname
restart: no # Required to avoid container restarting indefinitely
labels:
io.balena.features.supervisor-api: 1 # Required to interact with the supervisor
environment:
SET_HOSTNAME: balena-test-hostname
```