How to add hosts records for a new website?

I deployed frappe using Docker, and then I wanted to create a new site dev.localhost. This step was also successful, but during execution (the command I executed in the container):

bench --site dev.localhost add-to-hosts

Error prompt: sudo - not found

Then I tried executing the command on the host computer:

docker-compose exec backend bench --site dev.localhost add-to-hosts

And then it also went wrong.

In the container, I tried manually editing/etc/hosts and adding the corresponding records, but because the user is frappe instead of root, I still couldn’t add and save them.

Can you tell me what I should do?

Who can answer it? Thank you!

39 viewers, but no one answered? really sad.

You can manually add it to /etc/hosts

You’d need a line like

127.0.0.1 dev.localhost (that’s essentially what the command does)

::1 dev.localhost if you use ipv6.

Though for a site ending with .localhost, this step shouldn’t be required, I’ve seen DNS automatically resolve these hostnames to localhost.

Thank you for your reply. I know I should do this. My problem is that I don’t have the permission to edit and save this document.

Strange. This is a very common operation. Am I the only one who has encountered this problem?