Docker build gives “unable to prepare context: context must be a directory: /Users/tempUser/git/docker/Dockerfile”

前端 未结 7 1814
野趣味
野趣味 2021-01-31 12:57

I have a Dockerfile that is supposed to build an Ubuntu image. But whenever I run

docker build -t ubuntu-test:latest ./Dockerfile

it shows the fo

7条回答
  •  情歌与酒
    2021-01-31 13:43

    To specify a Dockerfile when build, you can use:

    docker build -t ubuntu-test:latest - < /path/to/your/Dockerfile
    

    But it'll fail if there's ADD or COPY command that depends on relative path. There're many ways to specify a context for docker build, you can refer to docs of docker build for more info.

提交回复
热议问题