@@ -148,19 +148,18 @@ public void createContainerWithVolumesFrom() throws DockerException {
148148 String container1Name = UUID .randomUUID ().toString ();
149149 CreateVolumeResponse volume1Info = dockerRule .getClient ().createVolumeCmd ().exec ();
150150 CreateVolumeResponse volume2Info = dockerRule .getClient ().createVolumeCmd ().exec ();
151- String mountpoint1 = volume1Info .getMountpoint ();
152- String mountpoint2 = volume2Info .getMountpoint ();
153- Volume volume1 = new Volume (mountpoint1 );
154- Volume volume2 = new Volume (mountpoint2 );
155151
156- Bind bind1 = new Bind ("/src/webapp1" , volume1 );
157- Bind bind2 = new Bind ("/src/webapp2" , volume2 );
152+ Volume volume1 = new Volume ("/src/webapp1" );
153+ Volume volume2 = new Volume ("/src/webapp2" );
154+ Bind bind1 = new Bind (volume1Info .getName (), volume1 );
155+ Bind bind2 = new Bind (volume2Info .getName (), volume2 );
158156
159157 // create a running container with bind mounts
160158 CreateContainerResponse container1 = dockerRule .getClient ().createContainerCmd (DEFAULT_IMAGE )
161159 .withCmd ("sleep" , "9999" )
162160 .withName (container1Name )
163- .withBinds (bind1 , bind2 ).exec ();
161+ .withBinds (bind1 , bind2 )
162+ .exec ();
164163
165164 LOG .info ("Created container1 {}" , container1 .toString ());
166165
@@ -185,6 +184,7 @@ public void createContainerWithVolumesFrom() throws DockerException {
185184 // No volumes are created, the information is just stored in .HostConfig.VolumesFrom
186185 assertThat (inspectContainerResponse2 .getHostConfig ().getVolumesFrom (),
187186 hasItemInArray (new VolumesFrom (container1Name )));
187+ assertThat (inspectContainerResponse1 , mountedVolumes (containsInAnyOrder (volume1 , volume2 )));
188188
189189 // To ensure that the information stored in VolumesFrom really is considered
190190 // when starting the container, we start it and verify that it has the same
0 commit comments