networking – equivalent of –net=host in dockerfile when creating docker container

I trieddocker run --net=host -d --name pdns-recursor pschiffe/pdns-recursor and it works. Now my goal is to use dockerfile to pass some environment without errors.

I tried:

  name: host


  name: "host"

and also the examples indicated here.

I always get an The Compose file './docker-compose.yml' is invalid because: contains an invalid type, it should be an object, or a null.

Any suggestions are much appreciated.