diff --git a/docker-compose-generator/src/DockerComposeDefinition.cs b/docker-compose-generator/src/DockerComposeDefinition.cs index 5fbdef8..def8cf9 100644 --- a/docker-compose-generator/src/DockerComposeDefinition.cs +++ b/docker-compose-generator/src/DockerComposeDefinition.cs @@ -80,8 +80,9 @@ namespace DockerGenerator .GroupBy(s => s.Key.ToString(), s => s.Value) .Select(group => (GroupName: group.Key, - MainNode: group.OfType().Single(n => n.Children.ContainsKey("image")), + MainNode: group.OfType().SingleOrDefault(n => n.Children.ContainsKey("image")), MergedNodes: group.OfType().Where(n => !n.Children.ContainsKey("image")))) + .Where(_ => _.MainNode != null) .Select(_ => { foreach(var node in _.MergedNodes)