instruction: Create a comprehensive Dockerfile for networking applications with best practices
output: ```dockerfile
  from swarm managers and
  workers. If you create swarm services and do not specify a network, they are
  connected to the ingress network. It is recommended that you use separate
  overlay networks for each application or group of applications which will work
  together. In the next procedure, you will create two overlay networks and
  connect a service to each of them.Create the servicesOn manager, create a new overlay network called nginx-net:
  
  $ docker network create -d overlay nginx-net
  You don't need to create the overlay network on the other nodes, because it
  will be automatically created when one of those nodes starts running a
  service task which requires it.On manager, create a 5-replica Nginx service connected to nginx-net. The
  service will publish port 80 to the outside world. All of the service
  task containers can communicate with each other without opening any ports.
  NoteServices can only be created on a manager.
  
  $ docker service create \
   --name my-nginx \
   --publish target=80,published=80 \
   --replicas=5 \
   --network nginx-net \
   nginx
  The default publish mode of ingress, which is used when you do not
  specify a mode for the --publish flag, means that if you browse to
  port 80 on manager, worker-1, or worker-2, you will be connected to
  port 80 on one of the 5 service tasks, even if no tasks are currently
  running on the node you browse to. If you want to publish the port using
  host mode, you can add mode=host to the --publish output. However,
  you should also use --mode global instead of --replicas=5 in this case,
  since only one service task can bind a given port on a given node.Run docker service ls to monitor the progress of service bring-up, which
  may take a few seconds.Inspect the nginx-net network on manager, worker-1, and worker-2.
  Remember that you did not need to create it manually on worker-1 and
  worker-2 because Docker created it for you. The output will be long, but
  notice the Containers and Peers sections. Containers lists all
  service tasks (or standalone containers) connected to the overlay network
  ```