Exposing several ports unnecessarily can be a security risk, by exposing ports there will be a channel for unsecured communications and unrestricted traffic. By creating a special networks for the containers to share, the host is isolated from the multiple containers utilized.