@@ -25,11 +25,13 @@ public struct ParsedVolume {
2525    public  let  name :  String 
2626    public  let  destination :  String 
2727    public  let  options :  [ String ] 
28+     public  let  isAnonymous :  Bool 
2829
29-     public  init ( name:  String ,  destination:  String ,  options:  [ String ]  =  [ ] )  { 
30+     public  init ( name:  String ,  destination:  String ,  options:  [ String ]  =  [ ] ,  isAnonymous :   Bool   =   false )  { 
3031        self . name =  name
3132        self . destination =  destination
3233        self . options =  options
34+         self . isAnonymous =  isAnonymous
3335    } 
3436} 
3537
@@ -368,8 +370,7 @@ public struct Parser {
368370                case  " tmpfs " : 
369371                    fs. type =  Filesystem . FSType. tmpfs
370372                case  " volume " : 
371-                     // Volume type will be set later in source parsing when we create the actual volume filesystem
372-                     break 
373+                     isVolume =  true 
373374                default : 
374375                    throw  ContainerizationError ( . invalidArgument,  message:  " unsupported mount type  \( val) " ) 
375376                } 
@@ -416,7 +417,6 @@ public struct Parser {
416417                    } 
417418
418419                    // This is a named volume
419-                     isVolume =  true 
420420                    volumeName =  val
421421                    fs. source =  val
422422                case  " tmpfs " : 
@@ -434,11 +434,19 @@ public struct Parser {
434434        guard  isVolume else  { 
435435            return  . filesystem( fs) 
436436        } 
437+ 
438+         // If it's a volume type but no source was provided, create an anonymous volume
439+         let  isAnonymous  =  volumeName. isEmpty
440+         if  isAnonymous { 
441+             volumeName =  VolumeStorage . generateAnonymousVolumeName ( ) 
442+         } 
443+ 
437444        return  . volume( 
438445            ParsedVolume ( 
439446                name:  volumeName, 
440447                destination:  fs. destination, 
441-                 options:  fs. options
448+                 options:  fs. options, 
449+                 isAnonymous:  isAnonymous
442450            ) ) 
443451    } 
444452
@@ -459,7 +467,19 @@ public struct Parser {
459467        let  parts  =  vol. split ( separator:  " : " ) 
460468        switch  parts. count { 
461469        case  1 : 
462-             throw  ContainerizationError ( . invalidArgument,  message:  " anonymous volumes are not supported " ) 
470+             // Anonymous volume: -v /path
471+             // Generate a random name for the anonymous volume
472+             let  anonymousName  =  VolumeStorage . generateAnonymousVolumeName ( ) 
473+             let  destination  =  String ( parts [ 0 ] ) 
474+             let  options :  [ String ]  =  [ ] 
475+ 
476+             return  . volume( 
477+                 ParsedVolume ( 
478+                     name:  anonymousName, 
479+                     destination:  destination, 
480+                     options:  options, 
481+                     isAnonymous:  true 
482+                 ) ) 
463483        case  2 ,  3 : 
464484            let  src  =  String ( parts [ 0 ] ) 
465485            let  dst  =  String ( parts [ 1 ] ) 
0 commit comments