英文:
docker build go project failed
问题
我尝试使用Docker构建一个Go语言项目。我按照这个项目的步骤进行操作,并成功地通过go build -o qnmahjong
构建了项目。但是当我运行docker build -t qnmahjong
时,它给出了一个错误提示:"docker buildx build"需要正好1个参数。我不确定是输出文件无效,还是docker命令没有将输出文件视为1个参数。
英文:
https://github.com/shuimuliang/qnmahjongserver
I tried to build a golang project with Docker. I have followed the steps from this project and successfully build the project by go build -o qnmahjong
. But when I run docker build -t qnmahjong
. It gives me error: "docker buildx build" requires exactly 1 argument.
I am not sure is that the output file is invalid or the docker command does not treat the output file as 1 argument.
答案1
得分: 5
将docker build -t qnmahjong
替换为docker build -t qnmahjong .
你漏掉了“.
”点号,点号表示你使用本地目录中的Dockerfile。
这将根据Dockerfile中的指令创建一个名为qnmahjong的Docker镜像。然后,你可以使用以下命令运行该镜像:
docker run qnmahjong
英文:
Replace docker build -t qnmahjong
with docker build -t qnmahjong .
You are missing the ".
" The dot means you use the Dockerfile in the local directory
This will create a Docker image named qnmahjong based on the instructions in the Dockerfile. You can then run the image using the following command:
docker run qnmahjong
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论