如何解决如何使用Google Clould Build从主机从Docker映像访问文件
我想将Docker映像中的node_modules.zip移到目录中的静态文件夹中。
当前,我的cloudbuild.yaml如下所示:
- id: package_js
name: gcr.io/numom-57642/test4:latest
entrypoint: /bin/bash
waitFor: ['-']
args:
- -c
- |
mv node_modules.zip static/
运行cloud-build-local时出现错误:
Step #1 - "package_js": mv: cannot stat 'node_modules.zip': No such file or directory
如何访问Docker映像中的node_modules.zip。
解决方法
嗯。。有趣。
我认为您在正确的道路上。
您应该能够将文件复制到默认挂载的/workspace
或新挂载的卷中:
- id: package_js
name: gcr.io/numom-57642/test4:latest
entrypoint: /bin/bash
volumes:
- name: 'scratch'
path: '/scratch'
args:
- -c
- |
cp node_modules.zip /workspace
cp node_modules.zip /scratch
然后:
- id: check
name: busybox
volumes:
- name: 'scratch'
path: '/scratch'
args:
- |
ls -l /workspace
ls -l /scratch
使用/workspace
更容易,因为您不需要挂接卷,但是使用/scratch
更明确。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。