gpt4 book ai didi

Some devcontainer images don't work in IntelliJ(某些DevContainer图像在IntelliJ中不起作用)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:43 30 4
gpt4 key购买 nike



I have a devcontainer working in VSCode, but I can't get the same image to work with an IntelliJ IDE. I tried checking the system requirements, and I think the image meets them. Are there other things needed in an image to be used as a devcontainer in IntelliJ?

我有一个在VSCode中工作的DevContainer,但我不能让相同的图像在IntelliJ IDE中工作。我试着检查了系统要求,我认为图像符合要求。在IntelliJ中,要用作DevContainer的图像还需要其他东西吗?


I've tried in both PyCharm 2023.2.1 Pro and IntelliJ IDEA 2023.2.1 Ultimate. I'm trying to use the mcr.microsoft.com/devcontainers/universal:2-linux image, because it doesn't count as storage space in GitHub codespaces. When I try it with the openjdk:11 image, it works.

我已经尝试了PyCharm 2023.2.1 Pro和IntelliJ Idea 2023.2.1旗舰版。我正在尝试使用mcr.microsoft.com/devcontainers/universal:2-linux映像,因为它在giHub代码空间中不算存储空间。当我用OpenJDK:11图像尝试它时,它起作用了。


Here's the display when I try to create a dev container:

下面是我尝试创建一个dev容器时的显示:


Deploying 'Dev Container'…
Creating container…
Container Id: 137057385eae5fd7eeb5fa53f3c47248f481a9095ad8ad31d840adb78a92dd1f
Container name: '/suspicious_galileo'
Starting container '/suspicious_galileo'
'Dev Container' has been deployed successfully.
Preparing environment...
Environment is successfully prepared...
Status 409: {"message":"Container 137057385eae5fd7eeb5fa53f3c47248f481a9095ad8ad31d840adb78a92dd1f is not running"}

Here's the full devcontainer.json:

下面是完整的devtainer.json:


{
"name": "udjango",
"image": "mcr.microsoft.com/devcontainers/universal:2-linux"
}

更多回答

Please try to create a Docker container using the image you mentioned. Does it start correctly? If so, please try to create an image using the following Dockerfile and check if it works: FROM mcr.microsoft.com/devcontainers/universal:2-linux RUN apt-get update && apt-get install -y curl wget unzip tar gzip

请尝试使用您提到的镜像创建一个Docker容器。它启动正确吗?如果是这样的话,请尝试使用以下Docker文件创建一个映像,并检查它是否工作:从mcr.microsoft.com/devcontainers/universal:2-linux运行apt-get update&&apt-get install-y curl wget unzip tar gzip

优秀答案推荐

It looks like the problem is that the GitHub default image has this weird entrypoint:

看起来问题在于GitHub的默认图片有一个奇怪的入口点:


            "Entrypoint": [
"/usr/local/share/docker-init.sh",
"/usr/local/share/ssh-init.sh"
]

If I override the entrypoint in my own Dockerfile, then it seems to work in VSCode, GitHub codespaces, and IntelliJ IDEs.

如果我覆盖我自己的Dockerfile中的入口点,那么它似乎可以在VSCode、GitHub代码空间和IntelliJ IDE中工作。


Here's the full devcontainer.json:

下面是完整的devtainer.json:


{
"name": "udjango",
"build": {
"dockerfile": "Dockerfile"
},
"postCreateCommand": ["pipenv", "install"],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash (2)",
"terminal.integrated.profiles.linux": {
"bash (2)": {
"path": "/home/codespace/.python/current/bin/pipenv-shell"
}
}
}
}
}
}

Here's the full Dockerfile:

以下是完整的Docker文件:


FROM mcr.microsoft.com/devcontainers/universal:2-linux

RUN python -m pip install pipenv && \
printf "export PIPENV_SHELL=bash\npipenv shell" >/home/codespace/.python/current/bin/pipenv-shell && \
chmod +x /home/codespace/.python/current/bin/pipenv-shell

ENTRYPOINT bash

更多回答

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com