Skip to content

Commit

Permalink
Check if the docker config is nil, fixes hashicorp#13371
Browse files Browse the repository at this point in the history
Sometimes the host network has a nil config, causing a crash on vagrant up when checking the docker networks
  • Loading branch information
tomjn committed Mar 28, 2024
1 parent d8fdc50 commit 5a191b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/providers/docker/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def network_defined?(subnet_string)
network_info = inspect_network(all_networks)
network_info.each do |network|
config = Array(network["IPAM"]["Config"])
if (config.size > 0 &&
if ( config &&
config.size > 0 &&
config.first["Subnet"] == subnet_string)
@logger.debug("Found existing network #{network["Name"]} already configured with #{subnet_string}")
return network["Name"]
Expand Down

0 comments on commit 5a191b3

Please sign in to comment.