@@ -501,20 +501,26 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
501
501
}
502
502
503
503
func (s * DockerSuite ) TestVolumesFromGetsProperMode (c * check.C ) {
504
+ testRequires (c , SameHostDaemon )
504
505
prefix , slash := getPrefixAndSlashFromDaemonPlatform ()
506
+ hostpath := randomTmpDirPath ("test" , daemonPlatform )
507
+ if err := os .MkdirAll (hostpath , 0755 ); err != nil {
508
+ c .Fatalf ("Failed to create %s: %q" , hostpath , err )
509
+ }
510
+ defer os .RemoveAll (hostpath )
505
511
506
512
// TODO Windows: Temporary check - remove once TP5 support is dropped
507
513
if daemonPlatform == "windows" && windowsDaemonKV < 14350 {
508
514
c .Skip ("Needs later Windows build for RO volumes" )
509
515
}
510
- dockerCmd (c , "run" , "--name" , "parent" , "-v" , prefix + slash + "test :"+ prefix + slash + "test:ro" , "busybox" , "true" )
516
+ dockerCmd (c , "run" , "--name" , "parent" , "-v" , hostpath + " :"+ prefix + slash + "test:ro" , "busybox" , "true" )
511
517
512
518
// Expect this "rw" mode to be be ignored since the inherited volume is "ro"
513
519
if _ , _ , err := dockerCmdWithError ("run" , "--volumes-from" , "parent:rw" , "busybox" , "touch" , prefix + slash + "test" + slash + "file" ); err == nil {
514
520
c .Fatal ("Expected volumes-from to inherit read-only volume even when passing in `rw`" )
515
521
}
516
522
517
- dockerCmd (c , "run" , "--name" , "parent2" , "-v" , prefix + slash + "test :"+ prefix + slash + "test:ro" , "busybox" , "true" )
523
+ dockerCmd (c , "run" , "--name" , "parent2" , "-v" , hostpath + " :"+ prefix + slash + "test:ro" , "busybox" , "true" )
518
524
519
525
// Expect this to be read-only since both are "ro"
520
526
if _ , _ , err := dockerCmdWithError ("run" , "--volumes-from" , "parent2:ro" , "busybox" , "touch" , prefix + slash + "test" + slash + "file" ); err == nil {
0 commit comments