Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevContainer: Exit code 137 #2

Open
Yumin-Sun-00 opened this issue Nov 9, 2024 · 15 comments
Open

DevContainer: Exit code 137 #2

Yumin-Sun-00 opened this issue Nov 9, 2024 · 15 comments

Comments

@Yumin-Sun-00
Copy link

I can not reopen folder to develop in a container.

Error message: An error occurred setting up the container.

[3142 ms] Installing VS Code Server for commit e8653663e8840adaf45af01eab5c627a5af81807
[3143 ms] Start: Installing VS Code Server
[3144 ms] Start: Run in container: mkdir -p /vscode/vscode-server/bin/linux-x64/e8653663e8840adaf45af01eab5c627a5af81807_1731177276323
[3191 ms] 
[3191 ms] 
[3308 ms] Start: Run in container: (dd iflag=fullblock bs=8192 count=7283; dd iflag=fullblock bs=6631 count=1) | tar --no-same-owner -xz -C /vscode/vscode-server/bin/linux-x64/e8653663e8840adaf45af01eab5c627a5af81807_1731177276323
[4618 ms] Exit code 137
[4618 ms] Keep-alive process ended.
[4619 ms] Start: Run in container: rm -rf /vscode/vscode-server/bin/linux-x64/e8653663e8840adaf45af01eab5c627a5af81807_1731177276323
[4622 ms] Shell server terminated (code: 137, signal: null)

My VM Workstation (Linux client):
Memory: 8GB
OS: RHEL8

@Yumin-Sun-00 Yumin-Sun-00 changed the title Docker build container: Exit code 137 DevContainer: Exit code 137 Nov 9, 2024
@Yumin-Sun-00
Copy link
Author

After adding these runArgs

--memory=8g --memory-swap=2g

in devcontainer.json the error messages changes to

[2626 ms] Error: Command failed: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/myuser/LFS148-code,target=/workspaces/LFS148-code --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/home/myuser/LFS148-code -l devcontainer.config_file=/home/myuser/LFS148-code/.devcontainer/devcontainer.json -e SHELL=/bin/bash -e EXERCISES=/workspaces/LFS148-code/exercises --privileged --memory=8g --memory-swap=2g --entrypoint /bin/sh -l devcontainer.metadata=[{"customizations":{"vscode":{"settings":{"files.autoSave":"afterDelay","[python]":{"editor.formatOnSave":true},"[dockercompose][yaml]":{"editor.defaultFormatter":"redhat.vscode-yaml","editor.formatOnPaste":true,"editor.formatOnSave":true,"editor.insertSpaces":true,"editor.tabSize":2},"[adoc][markdown]":{"editor.defaultFormatter":"vscode.markdown-language-features","editor.formatOnPaste":true,"editor.formatOnSave":true,"editor.insertSpaces":true,"editor.tabSize":2},"[dockerfile]":{"editor.quickSuggestions":{"strings":true},"editor.defaultFormatter":"ms-azuretools.vscode-docker"},"python.analysis.typeCheckingMode":"strict","python.analysis.autoImportCompletions":true},"extensions":["vscjava.vscode-java-pack","vscjava.vscode-java-dependency","ms-python.vscode-pylance","charliermarsh.ruff","ms-python.isort","ms-python.python","njpwerner.autodocstring","KevinRose.vsc-python-indent","ms-python.black-formatter","usernamehw.errorlens","redhat.vscode-yaml","ms-azuretools.vscode-docker"]}},"containerEnv":{"SHELL":"/bin/bash","EXERCISES":"/workspaces/LFS148-code/exercises"},"overrideCommand":false,"portsAttributes":{"5000":{"label":"Python Flask app"},"5001":{"label":"Python Flask app"},"5432":{"label":"Postgres DB"},"8080":{"label":"Spring Boot Backend app"},"8090":{"label":"Spring Boot Thymeleaf app"},"9090":{"label":"Prometheus UI"},"16686":{"label":"Jaeger UI"}},"forwardPorts":[5000,5001,5432,8080,8090,9090,16686]}] ghcr.io/lftraining/lfs148-code-application:latest -c echo Container started

@JenSeReal
Copy link
Contributor

Hi @Yumin-Sun-00 could you maybe try running Ctrl + Shift + P or Command + Shift + P on MacOS and type Dev Containers: Rebuild and Reopen in Container?

Rebuild and Reopen dialog in VS Code

@Yumin-Sun-00
Copy link
Author

Hi @JenSeReal

I provision a EC2 instance with Instance type m4.2xlarge, which means

image

And I remove my changes and have tried:

Dev Containers: Rebuild and Reopen in Container
Dev Containers: Rebuild Without Cache and Reopen in Container

Both returns with exit code 137.

@Yumin-Sun-00
Copy link
Author

Hi @JenSeReal

I provision a EC2 instance with Instance type m4.2xlarge, which means

image And I remove my changes and have tried:

Dev Containers: Rebuild and Reopen in Container Dev Containers: Rebuild Without Cache and Reopen in Container

Both returns with exit code 137.

Maybe more system informarion of my EC2 instance might helpful?

# cat /proc/meminfo
MemTotal:       32639544 kB
MemFree:        26015840 kB
MemAvailable:   31394256 kB
Buffers:            3924 kB
Cached:          5590628 kB
SwapCached:            0 kB
Active:          1111928 kB
Inactive:        4852000 kB
Active(anon):       2084 kB
Inactive(anon):   393912 kB
Active(file):    1109844 kB
Inactive(file):  4458088 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB

@maeddes
Copy link
Contributor

maeddes commented Nov 10, 2024

Hi, I am not sure, if the problem originates from the memory config of your VM instance.

Can you give some more details about your setup. I understood RHEL8.
Which version of Docker do you use? Which version of VSCode?

If you use the way Jens has described before, there also is an option "Dev Containers: Show container log"
Can you please provide that? This would probably give us more background.
Or was the log snippet above the entire log?

If the rebuild step from above did not work, you may want to try to delete the stopped container instance and image directly via docker commands and completely start from scratch.

In general I am not sure if it makes a lot of sense to deploy a VM instance only for this purpose.
An complete alternative approach would be to use GitHub Codespaces for doing the lab. Here is a link how to set one up:
https://github.com/codespaces/new?skip_quickstart=true&machine=basicLinux32gb&repo=751957128&ref=main&devcontainer_path=.devcontainer%2Fdevcontainer.json

Here is some general codespace documentation, if this is new for you: https://docs.github.com/en/codespaces

@Yumin-Sun-00
Copy link
Author

Hi, I am not sure, if the problem originates from the memory config of your VM instance.

Can you give some more details about your setup. I understood RHEL8. Which version of Docker do you use? Which version of VSCode?

If you use the way Jens has described before, there also is an option "Dev Containers: Show container log" Can you please provide that? This would probably give us more background. Or was the log snippet above the entire log?

If the rebuild step from above did not work, you may want to try to delete the stopped container instance and image directly via docker commands and completely start from scratch.

In general I am not sure if it makes a lot of sense to deploy a VM instance only for this purpose. An complete alternative approach would be to use GitHub Codespaces for doing the lab. Here is a link how to set one up: https://github.com/codespaces/new?skip_quickstart=true&machine=basicLinux32gb&repo=751957128&ref=main&devcontainer_path=.devcontainer%2Fdevcontainer.json

Here is some general codespace documentation, if this is new for you: https://docs.github.com/en/codespaces

Hi @maeddes ,

# docker --version
Docker version 27.3.1, build ce12230

VS Code version: 1.95.2 (user setup)

Dev Containers version: v0.388.0

Delete images and containers I have to keep everything clean before rebuild:

# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    d2c94e258dcb   18 months ago   13.3kB

# docker ps -a
CONTAINER ID   IMAGE         COMMAND    CREATED             STATUS                         PORTS     NAMES
b639d9e02e9c   hello-world   "/hello"   About an hour ago   Exited (0) About an hour ago             amazing_torvalds

Now: In VS Code, reopen in containers --> exit code 137. Here is the logs:

[1180 ms] Dev Containers 0.388.0 ov.txt

Thanks for providing alternative. I will have a look now.

@Yumin-Sun-00
Copy link
Author

Hi, I am not sure, if the problem originates from the memory config of your VM instance.
Can you give some more details about your setup. I understood RHEL8. Which version of Docker do you use? Which version of VSCode?
If you use the way Jens has described before, there also is an option "Dev Containers: Show container log" Can you please provide that? This would probably give us more background. Or was the log snippet above the entire log?
If the rebuild step from above did not work, you may want to try to delete the stopped container instance and image directly via docker commands and completely start from scratch.
In general I am not sure if it makes a lot of sense to deploy a VM instance only for this purpose. An complete alternative approach would be to use GitHub Codespaces for doing the lab. Here is a link how to set one up: https://github.com/codespaces/new?skip_quickstart=true&machine=basicLinux32gb&repo=751957128&ref=main&devcontainer_path=.devcontainer%2Fdevcontainer.json
Here is some general codespace documentation, if this is new for you: https://docs.github.com/en/codespaces

Hi @maeddes ,

# docker --version
Docker version 27.3.1, build ce12230

VS Code version: 1.95.2 (user setup)

Dev Containers version: v0.388.0

Delete images and containers I have to keep everything clean before rebuild:

# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    d2c94e258dcb   18 months ago   13.3kB

# docker ps -a
CONTAINER ID   IMAGE         COMMAND    CREATED             STATUS                         PORTS     NAMES
b639d9e02e9c   hello-world   "/hello"   About an hour ago   Exited (0) About an hour ago             amazing_torvalds

Now: In VS Code, reopen in containers --> exit code 137. Here is the logs:

[1180 ms] Dev Containers 0.388.0 ov.txt

Thanks for providing alternative. I will have a look now.

I found in the logs there is another exit code 128 before exit code 137:

fatal: detected dubious ownership in repository at '/workspaces/LFS148-code'
To add an exception for this directory, call:

    git config --global --add safe.directory /workspaces/LFS148-code

Do you think this could be the cause?

@maeddes
Copy link
Contributor

maeddes commented Nov 10, 2024

I think it could be, but I can't verify (yet). We've never seen this issue and we can't reproduce it

@JenSeReal
Copy link
Contributor

You could try to set the save directory in a startup command like this postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} in devcontainer.json.

@Yumin-Sun-00
Copy link
Author

Hi @JenSeReal ,

I have tried different versions of such commands

"initializeCommand": "sudo git config --system --add safe.directory '*'",
"postStartCommand": "sudo git config --system --add safe.directory '*'",
"initializeCommand": "git config --global --add safe.directory /workspaces",
"postStartCommand": "git config --global --add safe.directory  /workspaces",
"initializeCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",

None of them worked. I currently give up on this, and will try the codespaces as maeddes recommended.

Thanks for your support, I am appreciated on that.

@maeddes
Copy link
Contributor

maeddes commented Nov 12, 2024

Hi @Yumin-Sun-00

thanks for the updates here. We were still unable to reproduce this behaviour on our end.

If we get the chance, can you let us some details, about the VM and in particular the OS and settings.
I would really like to figure this out before more people step into these problems.

many thanks for patience here!

@Yumin-Sun-00
Copy link
Author

Hi @maeddes

I was also thinking about it is because of VM workstation, therefore at the beginning I provision a ec2 instance to try again.

I think this is more related to Git new security features, that the owner of files must match to the user who perform git operations. I found in github there were/are issues/discussions about this new features, some solutions are proposed. But it seems like there are still people suffering from this.

It sounds like it is about when .gitconfig will be copy pasted from host into the container.

From this perspective, I think it is less relevant to VMs, though at the beginning I indeed had such idea, therefore you see I provisioned a new ec2 instance.

I see 2 options to fix this, however I am not familiar with docker container.

  1. What could make sure .gitconfig will be copied from local host into container.
  2. Create a user inside container that matches the owner of repository.

I just roughly say out my opinions, but I do not know whether this is promising.

BTW the codes pace things also not work by me, not sure whether it is because I am using my company laptop....

Have a good day!

🍻

@JenSeReal
Copy link
Contributor

You could also maybe try to download the repo as a zip file or to just delete the .git/ folder

@Yumin-Sun-00
Copy link
Author

You could also maybe try to download the repo as a zip file or to just delete the .git/ folder

Hey, that is a good idea! I get rid of the exit code 128 now 🎶🤩🥳

However, it still not work 🥲😂😂😂😂😂😂😂😂 Here is the log...I am done with this, I have to move on. It is a nice tutorial though that I wish to have a look very long time.

[2024-11-12T152355.546Z] Dev Contai.txt

@maeddes
Copy link
Contributor

maeddes commented Nov 12, 2024

first of all thanks for providing all the feedback here. If we can resolve it we will reach out to you. Sorry we couldn't make it work yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants