我从 Dockerfile 构建时需要 hello.rpm
,但是这个 rpm 文件在线不可用。
现在我通过启动一个临时网络服务器来提供文件,但理想情况下我想运行一个 build 命令,使这个本地文件在容器中可用。
这可能吗?
我的构建命令:
docker build -t fredrik/helloworld:1.0 .
我的 Dockerfile:
FROM centos:6
RUN rpm -ivh hello.rpm
最佳答案
你为什么不COPY执行 RUN
之前容器内的文件?
FROM centos:6
COPY hello.rpm /tmp/hello.rpm
RUN rpm -ivh /tmp/hello.rpm
这假定在您构建时 hello.rpm
位于您的 Dockerfile
旁边。
https://stackoverflow.com/questions/34872620/
相关文章:
python - 为什么人们在 docker 容器中创建 virtualenv?
amazon-web-services - 如何将 Kubernetes 日志发送到 AWS Clo
string - docker-compose.yml invalid : app. build c
docker - 在 Dockerbuild 文件中使用 docker-compose 环境变量
docker - boot2docker 存储的 docker 镜像在哪里?
windows - docker 警告 : failed to get default regist
mysql - 使用 docker-compose 来创建 MySQL 模式/数据库