I'm trying to deploy a custom image to an azure function and I have a requirement of modifying /etc/hosts
file inside the container.
I've tried giving --add-host
argument at the docker build stage but it doesn't help. And as it is an azure function, It'll run the docker run command by itself without manual intervention.
So, just wanted to know if there's a possibility of adding --add-host
argument to docker run command through Azure function's configuration.
I'm afraid it's impossible to add --add-host
argument to the docker run command. That's the function runtime and it's deployed by the Azure platform. You cannot change any parameters in it.
If you want to modify the /etc/hosts
file, there are two ways to do it as I know. One is that change it directly when you create the custom image. Another one is that enable the SSH server in the custom image and then change the /etc/hosts
file when the function runs well from your custom image via the SSH connection.