{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/61514779","id":61514779,"diff_hunk":"@@ -461,6 +462,20 @@ Json Parameters:\n     -   **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.\n     -   **VolumeDriver** - Driver that this container users to mount volumes.\n     -   **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.\n+    -   **Mounts** - List of mount configurations to create the container with. This replaces `Binds` and `Volumes`. If `Mounts` is specified along with either `Binds` or `Volumes`, the request will be rejected. Fields for a mount configuration:\n+          + **Type** - String specifying the type of mount, e.g. `hostbind`, `ephemeral`, or `persistent` (required)\n+          + **Source** - String specifying the host path to use for the mount. Path must exist. (required, `hostbind` only)\n+          + **Destination** - String specifying the container destination path for the mount (required)\n+          + **Driver** - String specifying the driver to use when creating a volume (required, `persistent` only)\n+          + **Name** - String specifying the name of the volume to create (required, `persistent` only)\n+          + **Mode** - comma sepparated list of mount modes, e.g. `ro`, `rw`, `nocopy`\n+          + **CreateOpts** - A map of key/value pairs (strings) to use when creating the volume, passed directly to the volume driver. (`persistent only)\n+\n+          Mount types:\n+            + **hostbind** - Mounts a file or directory from the host into the container. Must exist prior to creating the container.","path":"docs/reference/api/docker_remote_api_v1.24.md","position":24,"original_position":24,"commit_id":"44e31b866e589bf71bf675b95a7bcc5cfa8dbbb1","original_commit_id":"ba06fec4d90c292e0511bbd5af5d8e404e7f410d","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"body":"It's not changing the existing behavior, but introduces new behavior with this new API.","created_at":"2016-04-28T22:46:01Z","updated_at":"2016-04-28T22:46:01Z","html_url":"https://github.com/docker/docker/pull/22373#discussion_r61514779","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/22373","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/61514779"},"html":{"href":"https://github.com/docker/docker/pull/22373#discussion_r61514779"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/22373"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/22373","id":68113159,"html_url":"https://github.com/docker/docker/pull/22373","diff_url":"https://github.com/docker/docker/pull/22373.diff","patch_url":"https://github.com/docker/docker/pull/22373.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/22373","number":22373,"state":"open","locked":false,"title":"Add new `HostConfig` field, `Mounts`.","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"body":"**- What I did**\r\nAdd capability to `/containers/create` API to specify mounts in a more granular and safer way\r\n\r\n`Mounts` allows users to specify in a much safer way the volumes they\r\nwant to use in the container.\r\n\r\n**- How I did it**\r\nAdd new field `Mounts` to HostConfig as well as new `MountConfig`\r\n\r\nThis replaces `Binds` and `Volumes`, which both still exist, but\r\n`Mounts` and `Binds`/`Volumes` are exclusive.\r\nThe CLI will continue to use `Binds` and `Volumes` due to concerns with\r\nparsing the volume specs on the client side and cross-platform support.\r\n\r\n**- How to verify it**\r\nExample usage of `Mounts`:\r\n\r\n```\r\n$ curl -XPOST localhost:2375/containers/create -d '{\r\n  \"Image\": \"alpine:latest\",\r\n  \"HostConfig\": {\r\n    \"Mounts\": [{\r\n      \"Type\": \"ephemeral\",\r\n      \"Destination\": \"/foo\"\r\n      },{\r\n      \"Type\": \"hostbind\",\r\n      \"Source\": \"/var/run/docker.sock\",\r\n      \"Destination\": \"/var/run/docker.sock\",\r\n      },{\r\n      \"Type\": \"persistent\",\r\n      \"Name\": \"important_data\",\r\n      \"Destination\": \"/var/data\",\r\n      \"Mode\": \"ro\"\r\n      \"Driver\": \"awesomeStorage\",\r\n      \"CreateOpts\": { \"Size\": \"10G\" }\r\n      }]\r\n    }\r\n}'\r\n```\r\n\r\nThere are currently 3 types of mounts:\r\n\r\n  - **ephemeral**: Essentially scratch space on disk and are\r\n    removed when the container is removed\r\n  - **hostbind**: Paths on the host that get mounted into the\r\n    container. Paths must exist prior to creating the container.\r\n  - **persistent**: Volumes that have names and persist after the\r\n    container is removed.\r\n\r\nNot all fields are available in each type, and validation is done to\r\nensure these fields aren't mixed up between types.\r\n\r\n**- Description for the changelog**\r\n<!--\r\nWrite a short (one line) summary that describes the changes in this\r\npull request for inclusion in the changelog:\r\n-->\r\nAdd capability to `/containers/create` API to specify mounts in a more granular and safer way\r\n\r\n**- A picture of a cute animal (not mandatory but encouraged)**\r\n![](https://s3-us-west-2.amazonaws.com/lmooweb-media/images/be564897-10f3-4e99-a15f-24a6abb896dc.jpg)\r\n","created_at":"2016-04-27T19:46:47Z","updated_at":"2016-04-28T22:46:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"acdf53bc48f4cb862ff39a168088801ad987ea2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/22373/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/22373/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/22373/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/44e31b866e589bf71bf675b95a7bcc5cfa8dbbb1","head":{"label":"cpuguy83:add_mounts_api_on_create","ref":"add_mounts_api_on_create","sha":"44e31b866e589bf71bf675b95a7bcc5cfa8dbbb1","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"repo":{"id":15300899,"name":"docker","full_name":"cpuguy83/docker","owner":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cpuguy83/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/cpuguy83/docker","forks_url":"https://api.github.com/repos/cpuguy83/docker/forks","keys_url":"https://api.github.com/repos/cpuguy83/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cpuguy83/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cpuguy83/docker/teams","hooks_url":"https://api.github.com/repos/cpuguy83/docker/hooks","issue_events_url":"https://api.github.com/repos/cpuguy83/docker/issues/events{/number}","events_url":"https://api.github.com/repos/cpuguy83/docker/events","assignees_url":"https://api.github.com/repos/cpuguy83/docker/assignees{/user}","branches_url":"https://api.github.com/repos/cpuguy83/docker/branches{/branch}","tags_url":"https://api.github.com/repos/cpuguy83/docker/tags","blobs_url":"https://api.github.com/repos/cpuguy83/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cpuguy83/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cpuguy83/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/cpuguy83/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cpuguy83/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/cpuguy83/docker/languages","stargazers_url":"https://api.github.com/repos/cpuguy83/docker/stargazers","contributors_url":"https://api.github.com/repos/cpuguy83/docker/contributors","subscribers_url":"https://api.github.com/repos/cpuguy83/docker/subscribers","subscription_url":"https://api.github.com/repos/cpuguy83/docker/subscription","commits_url":"https://api.github.com/repos/cpuguy83/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/cpuguy83/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/cpuguy83/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/cpuguy83/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/cpuguy83/docker/contents/{+path}","compare_url":"https://api.github.com/repos/cpuguy83/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cpuguy83/docker/merges","archive_url":"https://api.github.com/repos/cpuguy83/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cpuguy83/docker/downloads","issues_url":"https://api.github.com/repos/cpuguy83/docker/issues{/number}","pulls_url":"https://api.github.com/repos/cpuguy83/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/cpuguy83/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/cpuguy83/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cpuguy83/docker/labels{/name}","releases_url":"https://api.github.com/repos/cpuguy83/docker/releases{/id}","deployments_url":"https://api.github.com/repos/cpuguy83/docker/deployments","created_at":"2013-12-19T02:58:40Z","updated_at":"2015-04-27T13:11:12Z","pushed_at":"2016-04-28T21:07:21Z","git_url":"git://github.com/cpuguy83/docker.git","ssh_url":"git@github.com:cpuguy83/docker.git","clone_url":"https://github.com/cpuguy83/docker.git","svn_url":"https://github.com/cpuguy83/docker","homepage":"http://www.docker.io","size":88406,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"717842fbdeeec3e3bd56525e998a2ffcb087b4d0","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","deployments_url":"https://api.github.com/repos/docker/docker/deployments","created_at":"2013-01-18T18:10:57Z","updated_at":"2016-04-28T21:35:16Z","pushed_at":"2016-04-28T22:44:26Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":190191,"stargazers_count":30839,"watchers_count":30839,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8760,"mirror_url":null,"open_issues_count":1525,"forks":8760,"open_issues":1525,"watchers":30839,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/22373"},"html":{"href":"https://github.com/docker/docker/pull/22373"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/22373"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/22373/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/22373/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/22373/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/44e31b866e589bf71bf675b95a7bcc5cfa8dbbb1"}}}}