我的代碼解決方案包含一個共享專案、Web 前端和 Web api 專案。由于 Dockerfile 無法訪問父檔案夾,Dockerfiles 需要位于我認為的根檔案夾中(前端和 api 都依賴于共享)。
所以我有 Dockerfile.api 如果我有 1.8 或更高版本(https://github.com/moby/moby/wiki),它是允許的。我有,我有最新的 4.2
呼叫Dockerfile(web api)是成功的,但是呼叫的docker build -f Dockerfile.api結果是這個錯誤:
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
我在這里錯過了什么?由于我的 repo 包含不同的專案,這將導致不同的影像,我想要不同的 Dockerfile,并且由于依賴關系,它們需要位于根目錄。
uj5u.com熱心網友回復:
docker build 需要有一個路徑引數來執行構建。
所以正確的命令是:
docker build -f Dockerfile.api .
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/368175.html
