seawall networks rename
Rename a network, keeping its subnet: a short cutover, then each stack deploys (severe).
Rename a network, keeping its subnet: a short cutover, then each stack deploys (severe)
Docker can't rename a network, and two can't share a subnet. So every container comes off it, it's made again under the new name with the same subnet, gateway, options and bridge interface, and each container goes back on with its own address and aliases. The proxy then has to reach each backend by name, or the old network comes back as it was. Then each stack's compose file names the new network and deploys, one at a time, the proxy checked after each; Portainer's own stack goes last, under Compose, and its API must answer after it.
Where a file keys the network by its old name, the key changes too. Compose hashes a service's networks by their keys, so each service on it is recreated. That takes a few seconds each and keeps volumes. --keys does only that, for a network an older seawall renamed.
Usage
seawall networks rename [OPTIONS] <OLD> [NEW]
Changes the host
Without --yes it prints the plan and changes nothing.
Arguments
<OLD>The network
<NEW>Its new name
Options
--askAsk for the new name, then show the plan and ask for the network's name typed (the TUI's r on a network)
--with <CONTAINER>A container no stack runs, moved with it (repeat or comma-separate)
--resumeFinish a rename that stopped part way
--keysAfter a rename by an older seawall: only the compose files' keys follow the new name (each stack is recreated)
--othersWrite compose files outside any stack that name it too (a copy kept first)
--yesCarry out the plan, after typing the network's name (without it, this is a dry run)
--confirm <NAME>The network's name, to confirm without a terminal
--waitAfter a redeploy, wait out the 2-minute compare with before. Without it the facts timer runs it (
SeawallDeployWorse)
Examples
seawall networks rename proxy edge
seawall networks rename proxy edge --yes
seawall networks rename proxy edge --resume --yes
seawall networks rename lan proxy --keys
Notes
Everything on the network is unreachable for a few seconds; each stack whose compose file keys the network by its old name is recreated.