英文:
Docker image not running
问题
我已经成功构建了我的Docker镜像,所以我正在尝试运行它,但是我遇到了这个错误。这可能听起来很愚蠢,但我对Docker不是很熟悉。
如果你能帮我解决问题,我将非常感激。我也不知道如何在stackoverflow上提问。无论如何,如果你能理解我的意思,你的回复将受到高度赞赏。
英文:
I've successfully built my docker image, so I'm trying to run it, I'm getting this error. This may sound stupid, but I'm not an expert in docker
This is my DockerfileThis is the error I'm getting
Pls if you can help me out. I also don't know how to use this stackoverflow to ask questions tho. Anyway you could understand what i'm saying, your response would be high appreciated
答案1
得分: 0
当你构建它时,你将它放在/Portfolio_Backend
目录下,但是当你在CMD语句中运行它时,你运行的是/app/Portfolio_Backend
。这就是为什么它找不到它的原因。
你可能想要的是将可执行文件放在app
目录中,所以将你的构建命令改为:
RUN go build -o Portfolio_Backend
即删除名称中的前导斜杠。然后它将位于app
目录中,并且应该可以正常工作。
另外,请注意在Stack Overflow上发布文本图片是不被赞同的。原因是对于任何想要尝试重现你的问题的人来说,从你的图片中复制/粘贴是很困难的。
英文:
When you build it, you put it in /Portfolio_Backend
, but when you run it in the CMD statement, you run /app/Portfolio_Backend
. That's why it can't find it.
What you want is probably to have the executable in the app
directory, so change your build command to
RUN go build -o Portfolio_Backend
i.e. remove the leading slash in the name. Then it'll be in the app
directory and it should work.
Also please note that posting images of text is frowned upon on Stack Overflow. The reason is that it's hard to copy/paste from your images for anyone that wants to try to reproduce your issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论