This fix tries to address the issue mentioned in Docker Remote API where
the examples for creating a container (`POST /containers/create`) with
volumes were incorrect. In the previous remote API document, the `Mounts`
fields was used for volume creation yet since v1.20 `Volumes` should be
used.
This fix fixes #21335.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -154,14 +154,9 @@ Create a container |
| 154 | 154 |
"com.example.license": "GPL", |
| 155 | 155 |
"com.example.version": "1.0" |
| 156 | 156 |
}, |
| 157 |
- "Mounts": [ |
|
| 158 |
- {
|
|
| 159 |
- "Source": "/data", |
|
| 160 |
- "Destination": "/data", |
|
| 161 |
- "Mode": "ro,Z", |
|
| 162 |
- "RW": false |
|
| 163 |
- } |
|
| 164 |
- ], |
|
| 157 |
+ "Volumes": {
|
|
| 158 |
+ "/volumes/data": {}
|
|
| 159 |
+ } |
|
| 165 | 160 |
"WorkingDir": "", |
| 166 | 161 |
"NetworkDisabled": false, |
| 167 | 162 |
"MacAddress": "12:34:56:78:9a:bc", |
| ... | ... |
@@ -245,7 +240,8 @@ Json Parameters: |
| 245 | 245 |
- **Entrypoint** - Set the entry point for the container as a string or an array |
| 246 | 246 |
of strings. |
| 247 | 247 |
- **Image** - A string specifying the image name to use for the container. |
| 248 |
-- **Mounts** - An array of mount points in the container. |
|
| 248 |
+- **Volumes** - An object mapping mount point paths (strings) inside the |
|
| 249 |
+ container to empty objects. |
|
| 249 | 250 |
- **WorkingDir** - A string specifying the working directory for commands to |
| 250 | 251 |
run in. |
| 251 | 252 |
- **NetworkDisabled** - Boolean value, when true disables networking for the |
| ... | ... |
@@ -158,14 +158,9 @@ Create a container |
| 158 | 158 |
"com.example.license": "GPL", |
| 159 | 159 |
"com.example.version": "1.0" |
| 160 | 160 |
}, |
| 161 |
- "Mounts": [ |
|
| 162 |
- {
|
|
| 163 |
- "Source": "/data", |
|
| 164 |
- "Destination": "/data", |
|
| 165 |
- "Mode": "ro,Z", |
|
| 166 |
- "RW": false |
|
| 167 |
- } |
|
| 168 |
- ], |
|
| 161 |
+ "Volumes": {
|
|
| 162 |
+ "/volumes/data": {}
|
|
| 163 |
+ } |
|
| 169 | 164 |
"WorkingDir": "", |
| 170 | 165 |
"NetworkDisabled": false, |
| 171 | 166 |
"MacAddress": "12:34:56:78:9a:bc", |
| ... | ... |
@@ -256,7 +251,8 @@ Json Parameters: |
| 256 | 256 |
- **Entrypoint** - Set the entry point for the container as a string or an array |
| 257 | 257 |
of strings. |
| 258 | 258 |
- **Image** - A string specifying the image name to use for the container. |
| 259 |
-- **Mounts** - An array of mount points in the container. |
|
| 259 |
+- **Volumes** - An object mapping mount point paths (strings) inside the |
|
| 260 |
+ container to empty objects. |
|
| 260 | 261 |
- **WorkingDir** - A string specifying the working directory for commands to |
| 261 | 262 |
run in. |
| 262 | 263 |
- **NetworkDisabled** - Boolean value, when true disables networking for the |
| ... | ... |
@@ -246,17 +246,6 @@ Create a container |
| 246 | 246 |
"com.example.license": "GPL", |
| 247 | 247 |
"com.example.version": "1.0" |
| 248 | 248 |
}, |
| 249 |
- "Mounts": [ |
|
| 250 |
- {
|
|
| 251 |
- "Name": "fac362...80535", |
|
| 252 |
- "Source": "/data", |
|
| 253 |
- "Destination": "/data", |
|
| 254 |
- "Driver": "local", |
|
| 255 |
- "Mode": "ro,Z", |
|
| 256 |
- "RW": false, |
|
| 257 |
- "Propagation": "" |
|
| 258 |
- } |
|
| 259 |
- ], |
|
| 260 | 249 |
"Volumes": {
|
| 261 | 250 |
"/volumes/data": {}
|
| 262 | 251 |
} |
| ... | ... |
@@ -366,7 +355,8 @@ Json Parameters: |
| 366 | 366 |
- **Entrypoint** - Set the entry point for the container as a string or an array |
| 367 | 367 |
of strings. |
| 368 | 368 |
- **Image** - A string specifying the image name to use for the container. |
| 369 |
-- **Mounts** - An array of mount points in the container. |
|
| 369 |
+- **Volumes** - An object mapping mount point paths (strings) inside the |
|
| 370 |
+ container to empty objects. |
|
| 370 | 371 |
- **WorkingDir** - A string specifying the working directory for commands to |
| 371 | 372 |
run in. |
| 372 | 373 |
- **NetworkDisabled** - Boolean value, when true disables networking for the |
| ... | ... |
@@ -265,17 +265,6 @@ Create a container |
| 265 | 265 |
"com.example.license": "GPL", |
| 266 | 266 |
"com.example.version": "1.0" |
| 267 | 267 |
}, |
| 268 |
- "Mounts": [ |
|
| 269 |
- {
|
|
| 270 |
- "Name": "fac362...80535", |
|
| 271 |
- "Source": "/data", |
|
| 272 |
- "Destination": "/data", |
|
| 273 |
- "Driver": "local", |
|
| 274 |
- "Mode": "ro,Z", |
|
| 275 |
- "RW": false, |
|
| 276 |
- "Propagation": "" |
|
| 277 |
- } |
|
| 278 |
- ], |
|
| 279 | 268 |
"Volumes": {
|
| 280 | 269 |
"/volumes/data": {}
|
| 281 | 270 |
} |
| ... | ... |
@@ -386,7 +375,8 @@ Json Parameters: |
| 386 | 386 |
- **Entrypoint** - Set the entry point for the container as a string or an array |
| 387 | 387 |
of strings. |
| 388 | 388 |
- **Image** - A string specifying the image name to use for the container. |
| 389 |
-- **Mounts** - An array of mount points in the container. |
|
| 389 |
+- **Volumes** - An object mapping mount point paths (strings) inside the |
|
| 390 |
+ container to empty objects. |
|
| 390 | 391 |
- **WorkingDir** - A string specifying the working directory for commands to |
| 391 | 392 |
run in. |
| 392 | 393 |
- **NetworkDisabled** - Boolean value, when true disables networking for the |
| ... | ... |
@@ -265,17 +265,6 @@ Create a container |
| 265 | 265 |
"com.example.license": "GPL", |
| 266 | 266 |
"com.example.version": "1.0" |
| 267 | 267 |
}, |
| 268 |
- "Mounts": [ |
|
| 269 |
- {
|
|
| 270 |
- "Name": "fac362...80535", |
|
| 271 |
- "Source": "/data", |
|
| 272 |
- "Destination": "/data", |
|
| 273 |
- "Driver": "local", |
|
| 274 |
- "Mode": "ro,Z", |
|
| 275 |
- "RW": false, |
|
| 276 |
- "Propagation": "" |
|
| 277 |
- } |
|
| 278 |
- ], |
|
| 279 | 268 |
"Volumes": {
|
| 280 | 269 |
"/volumes/data": {}
|
| 281 | 270 |
} |
| ... | ... |
@@ -387,7 +376,8 @@ Json Parameters: |
| 387 | 387 |
- **Entrypoint** - Set the entry point for the container as a string or an array |
| 388 | 388 |
of strings. |
| 389 | 389 |
- **Image** - A string specifying the image name to use for the container. |
| 390 |
-- **Mounts** - An array of mount points in the container. |
|
| 390 |
+- **Volumes** - An object mapping mount point paths (strings) inside the |
|
| 391 |
+ container to empty objects. |
|
| 391 | 392 |
- **WorkingDir** - A string specifying the working directory for commands to |
| 392 | 393 |
run in. |
| 393 | 394 |
- **NetworkDisabled** - Boolean value, when true disables networking for the |