Docker build 给出“无法准备上下文:上下文必须是目录:/Users/tempUser/git/docker/Dockerfile" [英] Docker build gives "unable to prepare context: context must be a directory: /Users/tempUser/git/docker/Dockerfile"

查看:43
本文介绍了Docker build 给出“无法准备上下文:上下文必须是目录:/Users/tempUser/git/docker/Dockerfile"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于构建 Ubuntu 映像的 Dockerfile.但每当我跑步时

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 following error on the console

无法准备上下文:上下文必须是目录:/Users/tempUser/git/docker/Dockerfile

unable to prepare context: context must be a directory: /Users/tempUser/git/docker/Dockerfile

我在 Mac OsX 上.我也尝试过 sudo .没有任何效果.

I'm on Mac OsX. I tried to sudo as well. Nothing works.

推荐答案

您需要改为指向 目录.您不得指定 dockerfile.

You need to point to the directory instead. You must not specify the dockerfile.

docker build -t ubuntu-test:latest . 工作.

docker build -t ubuntu-test:latest ./Dockerfile 不起作用.

这篇关于Docker build 给出“无法准备上下文:上下文必须是目录:/Users/tempUser/git/docker/Dockerfile"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆