Remote API docs give incorrect example for creating a container with volumes.

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>
This commit is contained in:
Yong Tang 2016-04-01 01:57:40 +00:00
parent 8eb8a1d6b8
commit 4ed2040258
5 changed files with 16 additions and 54 deletions

View file

@ -154,14 +154,9 @@ Create a container
"com.example.license": "GPL", "com.example.license": "GPL",
"com.example.version": "1.0" "com.example.version": "1.0"
}, },
"Mounts": [ "Volumes": {
{ "/volumes/data": {}
"Source": "/data",
"Destination": "/data",
"Mode": "ro,Z",
"RW": false
} }
],
"WorkingDir": "", "WorkingDir": "",
"NetworkDisabled": false, "NetworkDisabled": false,
"MacAddress": "12:34:56:78:9a:bc", "MacAddress": "12:34:56:78:9a:bc",
@ -245,7 +240,8 @@ Json Parameters:
- **Entrypoint** - Set the entry point for the container as a string or an array - **Entrypoint** - Set the entry point for the container as a string or an array
of strings. of strings.
- **Image** - A string specifying the image name to use for the container. - **Image** - A string specifying the image name to use for the container.
- **Mounts** - An array of mount points in the container. - **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **WorkingDir** - A string specifying the working directory for commands to - **WorkingDir** - A string specifying the working directory for commands to
run in. run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the - **NetworkDisabled** - Boolean value, when true disables networking for the

View file

@ -158,14 +158,9 @@ Create a container
"com.example.license": "GPL", "com.example.license": "GPL",
"com.example.version": "1.0" "com.example.version": "1.0"
}, },
"Mounts": [ "Volumes": {
{ "/volumes/data": {}
"Source": "/data",
"Destination": "/data",
"Mode": "ro,Z",
"RW": false
} }
],
"WorkingDir": "", "WorkingDir": "",
"NetworkDisabled": false, "NetworkDisabled": false,
"MacAddress": "12:34:56:78:9a:bc", "MacAddress": "12:34:56:78:9a:bc",
@ -256,7 +251,8 @@ Json Parameters:
- **Entrypoint** - Set the entry point for the container as a string or an array - **Entrypoint** - Set the entry point for the container as a string or an array
of strings. of strings.
- **Image** - A string specifying the image name to use for the container. - **Image** - A string specifying the image name to use for the container.
- **Mounts** - An array of mount points in the container. - **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **WorkingDir** - A string specifying the working directory for commands to - **WorkingDir** - A string specifying the working directory for commands to
run in. run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the - **NetworkDisabled** - Boolean value, when true disables networking for the

View file

@ -246,17 +246,6 @@ Create a container
"com.example.license": "GPL", "com.example.license": "GPL",
"com.example.version": "1.0" "com.example.version": "1.0"
}, },
"Mounts": [
{
"Name": "fac362...80535",
"Source": "/data",
"Destination": "/data",
"Driver": "local",
"Mode": "ro,Z",
"RW": false,
"Propagation": ""
}
],
"Volumes": { "Volumes": {
"/volumes/data": {} "/volumes/data": {}
} }
@ -366,7 +355,8 @@ Json Parameters:
- **Entrypoint** - Set the entry point for the container as a string or an array - **Entrypoint** - Set the entry point for the container as a string or an array
of strings. of strings.
- **Image** - A string specifying the image name to use for the container. - **Image** - A string specifying the image name to use for the container.
- **Mounts** - An array of mount points in the container. - **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **WorkingDir** - A string specifying the working directory for commands to - **WorkingDir** - A string specifying the working directory for commands to
run in. run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the - **NetworkDisabled** - Boolean value, when true disables networking for the

View file

@ -265,17 +265,6 @@ Create a container
"com.example.license": "GPL", "com.example.license": "GPL",
"com.example.version": "1.0" "com.example.version": "1.0"
}, },
"Mounts": [
{
"Name": "fac362...80535",
"Source": "/data",
"Destination": "/data",
"Driver": "local",
"Mode": "ro,Z",
"RW": false,
"Propagation": ""
}
],
"Volumes": { "Volumes": {
"/volumes/data": {} "/volumes/data": {}
} }
@ -386,7 +375,8 @@ Json Parameters:
- **Entrypoint** - Set the entry point for the container as a string or an array - **Entrypoint** - Set the entry point for the container as a string or an array
of strings. of strings.
- **Image** - A string specifying the image name to use for the container. - **Image** - A string specifying the image name to use for the container.
- **Mounts** - An array of mount points in the container. - **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **WorkingDir** - A string specifying the working directory for commands to - **WorkingDir** - A string specifying the working directory for commands to
run in. run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the - **NetworkDisabled** - Boolean value, when true disables networking for the

View file

@ -265,17 +265,6 @@ Create a container
"com.example.license": "GPL", "com.example.license": "GPL",
"com.example.version": "1.0" "com.example.version": "1.0"
}, },
"Mounts": [
{
"Name": "fac362...80535",
"Source": "/data",
"Destination": "/data",
"Driver": "local",
"Mode": "ro,Z",
"RW": false,
"Propagation": ""
}
],
"Volumes": { "Volumes": {
"/volumes/data": {} "/volumes/data": {}
} }
@ -387,7 +376,8 @@ Json Parameters:
- **Entrypoint** - Set the entry point for the container as a string or an array - **Entrypoint** - Set the entry point for the container as a string or an array
of strings. of strings.
- **Image** - A string specifying the image name to use for the container. - **Image** - A string specifying the image name to use for the container.
- **Mounts** - An array of mount points in the container. - **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **WorkingDir** - A string specifying the working directory for commands to - **WorkingDir** - A string specifying the working directory for commands to
run in. run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the - **NetworkDisabled** - Boolean value, when true disables networking for the