MCPcopy
hub / github.com/serverless/serverless / removeNetworkIfExists

Method removeNetworkIfExists

packages/util/src/docker/index.js:884–893  ·  view source on GitHub ↗

* Removes a Docker network if it exists * @param {Object} params * @param {string} params.networkName - Name of the network to remove * @returns {Promise }

({ networkName })

Source from the content-addressed store, hash-verified

882 * @returns {Promise<void>}
883 */
884 async removeNetworkIfExists({ networkName }) {
885 const networks = await this.client.listNetworks()
886 const network = networks.find((n) => n.Name === networkName)
887
888 if (network) {
889 this.logger.debug(`Removing Docker network: ${networkName}`)
890 const networkInstance = this.client.getNetwork(network.Id)
891 await networkInstance.remove()
892 }
893 }
894
895 /**
896 * Gets a Docker network by name

Callers

nothing calls this directly

Calls 3

debugMethod · 0.80
getNetworkMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected