Need help with changing hostname

I want to change the hostname of the device i have got.
I tried it with the supervisor api, but failed. How can i change my hostname in an docker container?

Hi,

You can change the hostname in a docker container (application container) by using hostname command and please make sure it’s a privileged container, otherwise you won’t be able to change the hostname.

Thanks for your reply @nghiant2710 . I tried your command from a shell in a privileged container, but it didn´t work.

Here is set the hostname:

After setting the hostname i set it in minecraft:

But that occurs:
server-failure

But if i paste in the UUID:

Then it works:
uuid-succes

So i think nothing changed. :pensive:

Hello, the screen you posted seems to show the hostname has in fact changed. If you call hostname <name> it will set a new hostname, if you just call hostname it will display the current one, so it appears the hostname was correctly changed to balenaminecraft. Could you elaborate on why this does not appear to be working on your end?

@nazrhom i don´t know why the hostname isn´t doing anything. Maybe is the command only changing the hostname in the container. I will try it again with more labels given to the container.

Hey @AlexProgrammerDE sorry our support tool did not show the other images you posted after the first one, so I was missing some context. Have a look at https://www.balena.io/docs/reference/OS/overview/2.x/#dev-vs-prod-images the 3rd paragraph explains how to change the hostname of a device by editing the config.json I think this should be what you are looking for

@nazrhom looks good, but where should the config.json file be placed or copied?

@nazrhom i found it. How can i access the config.json file on the resin-boot partition? I am trying to do that from a container, but i dont know how to connect to the boot partition.

Hi @AlexProgrammerDE. Yes, the config.json is on the boot partition. You can access this partition by either popping the SD card into another machine and editing the file directly, or by opening an SSH connection (either using balena CLI or in the dashboard UI) to the host OS and editing the file /mnt/boot/config.json.

Good luck!
James.

@jimsynz @nazrhom @nghiant2710 i found also a better solution for that. :smile: Here is it: https://www.balena.io/docs/reference/supervisor/supervisor-api/#examples-13 I thinks that is better for me, because it works directly in the container. No additionall config.json editing is needed