【问题标题】:How to mount volume without using docker如何在不使用 docker 的情况下挂载卷
【发布时间】:2021-11-16 14:03:32
【问题描述】:

为了将目录挂载到容器,我使用了绑定挂载https://docs.docker.com/storage/bind-mounts/ 现在我正在尝试找到一种方法来替换$docker run -v 命令。

【问题讨论】:

    标签: kubernetes docker-run containerd runc cri-o


    【解决方案1】:

    如果您使用的是 kubernetes,因为它在您的标签中。您可以将卷挂载为主机路径。

    在 Pod 规范中:

      volumeMounts:
        - name: config
          mountPath: <PATH IN CONTAINER>
      volumes:
        - name: config
          hostPath:
            path: <YOUR LOCAL DIR PATH>
    

    查看https://kubernetes.io/docs/concepts/storage/volumes/了解更多详情

    【讨论】:

    • 有没有办法通过 crictl 命令的参数挂载卷?不幸的是,我们不选择配置 pod 规范
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-18
    • 2017-08-14
    • 2017-06-02
    • 1970-01-01
    • 2021-07-16
    • 1970-01-01
    相关资源
    最近更新 更多