【发布时间】:2021-09-17 05:51:02
【问题描述】:
我的 docker-compose.yml:
version: "3.8"
services:
web:
build:
context: .
args:
file_url: 'some-url'
我的 Dockerfile:
FROM ruby:2.7.4-bullseye
ARG file_url
RUN curl $file_url -L -o "file"
当我跑步时:
docker-compose up --build
我希望 Docker 会构建并启动我的容器。但相反,我得到了:
Step 4/12 : RUN curl $file_url -L -o "file"
---> Running in 59696c6274c7
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
很明显,构建参数没有传递给 Dockerfile。我在 Stackoverflow 上阅读了很多类似的帖子,但不知道出了什么问题。
还有一件事。我实际上可以用docker-compose build web 构建容器就好了。只是在我运行docker-compose up --build 或docker-compose up 时发生了错误。
【问题讨论】:
标签: docker docker-compose