[英]When file from volume in the docker-compose becomes available in Dockerfile?
I have docker-compose file looking similar to:我有 docker-compose 文件看起来类似于:
version: '3'
services:
my_service:
build:
context: ./my_service
ports:
- $SERVICE_HTTP_PORT:1234
volumes:
- $PATH_TO_FILE:/usr/local/share/ca-certificates/root.ca.crt
Then inside docker file I have following line: RUN chmod 644 /usr/local/share/ca-certificates/root.ca.crt && update-ca-certificates
然后在 docker 文件中,我有以下行:
RUN chmod 644 /usr/local/share/ca-certificates/root.ca.crt && update-ca-certificates
but that yields that there is no such file.但这会导致没有这样的文件。 As far as I understand that probably it is not available at that moment yet, but couldn't find any documentation for that.
据我所知,当时可能还没有,但找不到任何相关文档。
由于卷不是生成的图像本身的一部分,因此您无法在 Dockerfile 中写入它们
您必须将该命令写入 docker-compose 文件中
command: bash -c "chmod 644 /usr/local/share/ca-certificates/root.ca.crt && update-ca-certificates"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.