Docker Community Forums

Share and learn in the Docker community.

Could not set property: Failed to set static hostname: Device or resource busy

I’m running an Amazon Linux 2 image. Hostnamectl works for reading the setup. But when I issue “hostnamectl set-hostname newname” I get the error “Could not set property: Failed to set static hostname: Device or resource busy”.

Does anybody have any ideas on how to fix this?

Thanks

The docker run command has an option named --hostname="" which takes care of your /etc/hostname file.

The host-to-ip mapping in the /etc/hosts file can be managed with the option --add-host= then.