我正在使用docker environment
,这是docker for mac的预览功能。
我正在尝试将主机的kube配置文件装载到dev容器中的.kube目录中。
所以我写了一个主机路径卷装载,如下所示
version: "3.9"
services:
devcontainer:
build: .
tty: true
volumes:
- ./devcontainer/kube:/.kube
当我在docker for mac环境中运行它时,会出现以下错误日志。
Logs
Preparing to clone inside a volume
Installing credential helpers... done
Cloning into '/code'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.remote: Counting objects: 93% (82/88)
remote: Compressing objects: 100% (58/58), done.remote: Compressing objects: 98% (57/58)remote: Compressing objects: 81% (47/58)
remote: Total 88 (delta 27), reused 78 (delta 17), pack-reused 0
Receiving objects: 100% (88/88), 8.46 KiB | 866.00 KiB/s, done.Receiving objects: 80% (71/88)Receiving objects: 71% (63/88)Receiving objects: 53% (47/88)
Resolving deltas: 100% (27/27), done.
The Compose file '/var/folders/0z/wq3hw0m17q9cn44d4b1_c3r40000gn/T/volume-dev-container-demo-brave_dewdney/.docker/docker-compose.yaml' is invalid because:
services.devcontainer.volumes contains unsupported option: 'create_host_path'
也许还不支持docker for mac环境来装载主机路径卷?
如果是,我如何注入主机的配置文件?
有人能分享一些好主意吗?
尽量避免"在卷路径中。始终查看相对于本地计算机上的compose文件和相对于容器中的用户主目录的路径。在容器中使用绝对路径可能是个好主意。也许这会有所帮助。