azure - 通过远程 api 设置 Docker Volume Driver 选择

标签 azure docker

有没有办法通过“POST/containers/create”远程 API 设置 Docker 卷驱动程序选项?我想做这样的事情:

docker run -it -v $(docker volume create -d azurefile -o share=myshare):/data busybox

我可以创建一个卷并使用下面的 json 指定一个驱动程序,但我不确定是否有办法设置卷驱动程序选项。

"HostConfig": {
     "Binds": ["myshare:/data"],
     "VolumeDriver": "azurefile"
  }

最佳答案

似乎仅使用/containers/create 是不可能的,但可以通过先创建卷,然后将其挂载到容器来实现。

POST /volumes/create
{
  "Name": "myvolume",
  "Driver": "azurefile",
  "DriverOpts": {
    "share": "myshare"
  }
}

POST /containers/create
{
  "HostConfig": {
    "Binds": ["myvolume:/data"],
    "VolumeDriver": "azurefile"
   }
}

关于azure - 通过远程 api 设置 Docker Volume Driver 选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36535455/

相关文章:

c# - 在异步操作中的 TransactionScope 的 WebAPI 中使用自定义 IHttpActionInvoker

azure - 无法连接到 AKS 服务终结点

c# - 如何删除 Azure 服务总线主题上的死信消息

docker - 避免 docker-compose.yml 配置之间的端口冲突?

docker - 基于控制台的 dockerized kafka 消费者

ios - 从自定义 Node.js API 检索 Azure Blob

Azure函数: Is it possible to subscribe to multiple topics?

docker - 使用 dockerfile 在多个 docker 实例之间共享 tomcat 配置?

docker - 我可以在 docker 中创建一个 "template volume"吗?

docker - kubernetes 无法拉取本地镜像