mirror of
https://github.com/docker/docs.git
synced 2026-03-27 22:38:54 +07:00
Prevent panic on update --container-label-add
Signed-off-by: Tibor Vass <tibor@docker.com> (cherry picked from commit e462b4507a7020ae96ec4f4806877bff3a0cae99) Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
@@ -253,7 +253,7 @@ func updatePlacement(flags *pflag.FlagSet, placement *swarm.Placement) {
|
||||
|
||||
func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
|
||||
if flags.Changed(flagContainerLabelAdd) {
|
||||
if field == nil {
|
||||
if *field == nil {
|
||||
*field = map[string]string{}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
|
||||
}
|
||||
}
|
||||
|
||||
if field != nil && flags.Changed(flagContainerLabelRemove) {
|
||||
if *field != nil && flags.Changed(flagContainerLabelRemove) {
|
||||
toRemove := flags.Lookup(flagContainerLabelRemove).Value.(*opts.ListOpts).GetAll()
|
||||
for _, label := range toRemove {
|
||||
delete(*field, label)
|
||||
|
||||
Reference in New Issue
Block a user