Tear down network when restarting containers
This makes restart a bit slower for root containers, but it does make it more consistent with `podman stop` and `podman start` on a container. Importantly, `podman restart` will now recreate firewall rules if they were somehow purged. Fixes #5051 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
		
							parent
							
								
									4699d5e02d
								
							
						
					
					
						commit
						6d487c781a
					
				| 
						 | 
					@ -1254,6 +1254,12 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (err e
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							// Ensure we tear down the container network so it will be
 | 
				
			||||||
 | 
							// recreated - otherwise, behavior of restart differs from stop
 | 
				
			||||||
 | 
							// and start
 | 
				
			||||||
 | 
							if err := c.cleanupNetwork(); err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer func() {
 | 
						defer func() {
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue