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

Attempting to run a devcontainer using an existing docker-compose.yml fails #9895

Closed
ThomasOwens opened this issue May 17, 2024 · 3 comments
Closed
Assignees
Labels
containers Issue in vscode-remote containers

Comments

@ThomasOwens
Copy link

  • VSCode Version: 1.89.1

  • Local OS Version: Windows 11 Pro 10.0.22621 Build 22621

  • Remote OS Version:

  • Remote Extension/Connection Type: Dev Container

  • Logs:

[6186 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=testproject --filter label=com.docker.compose.service=web
[6294 ms] Start: Run: docker inspect --type container 61a40a4873be
[6385 ms] Start: Inspecting container
[6385 ms] Start: Run: docker inspect --type container 61a40a4873be5abc2747ba15a1a156d6d92d5688c2058c4e2f7431f5c3755605
[6478 ms] Start: Run in container: /bin/sh
[6485 ms] Start: Run in container: uname -m
[6570 ms] Shell server terminated (code: 1, signal: null)
[6570 ms] Error response from daemon: container 61a40a4873be5abc2747ba15a1a156d6d92d5688c2058c4e2f7431f5c3755605 is not running
[6571 ms] Start: Run in container:  (command -v getent >/dev/null 2>&1 && getent passwd 'root' || grep -E '^root|^[^:]*:[^:]*:root:' /etc/passwd || true)
[6571 ms] Stdin closed!
[6571 ms] Error: An error occurred setting up the container.
[6571 ms]     at utA (c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js:409:3888)
[6571 ms]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[6571 ms]     at async KtA (c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js:481:3865)
[6571 ms]     at async $C (c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js:481:4807)
[6571 ms]     at async hrA (c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js:661:13255)
[6571 ms]     at async lrA (c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js:661:12996)
[6580 ms] Exit code 1
[6583 ms] Command failed: C:\Program Files\Microsoft VS Code\Code.exe c:\Users\thoma\.vscode\extensions\ms-vscode-remote.remote-containers-0.362.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\thoma\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-22e6f661-cbe0-4ebf-8657-f9f6dfa10a6b1715950748061 --workspace-folder c:\Users\thoma\Projects\TestProject --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\thoma\Projects\TestProject --id-label devcontainer.config_file=c:\Users\thoma\Projects\TestProject\.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\thoma\Projects\TestProject\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\wayland-0,target=/tmp/vscode-wayland-91b5fcee-56ef-455b-b306-605b43ec7dae.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[6583 ms] Exit code 1

Steps to Reproduce:

  1. I created a Dockerfile and docker-compose file. When running these, independently, the container is built and runs as expected.
  2. I used the VS Code functionality to add Dev Container configuration files to the workspace, using a pre-existing docker-compose.yml.
  3. When I attempt to run and connect to the dev container, the above log is generated.

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Unsure.

@VSCodeTriageBot VSCodeTriageBot added the containers Issue in vscode-remote containers label May 17, 2024
@Ostrock
Copy link

Ostrock commented May 18, 2024

The same issue is happening in a POP_OS env:

Version: 1.88.1
Commit: e170252f762678dec6ca2cc69aba1570769a5d39
Date: 2024-04-10T17:34:12.840Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 6.8.0-76060800daily20240311-generic

Dev containers version: v0.362.0
Published 2019-05-02, 20:31:37
Last released 2024-05-16, 23:40:55
Last updated 2024-05-04, 20:30:37
Identifier ms-vscode-remote.remote-containers

image in dockerfile:
https://raw.githubusercontent.com/apache/spark-docker/master/3.5.1/scala2.12-java17-r-ubuntu/Dockerfile

Logs:

[2024-05-18T17:59:44.065Z] Stop (131433 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-ostrock/container-features/0.59.1-1716055052627/Dockerfile-with-features -t vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer/.devcontainer
[2024-05-18T17:59:44.067Z] Start: Run: docker inspect --type image vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453
[2024-05-18T17:59:44.098Z] Stop (31 ms): Run: docker inspect --type image vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453
[2024-05-18T17:59:44.102Z] Start: Run: docker build -f /tmp/devcontainercli-ostrock/updateUID.Dockerfile-0.59.1 -t vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453-uid --platform linux/amd64 --build-arg BASE_IMAGE=vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453 --build-arg REMOTE_USER=spark --build-arg NEW_UID=1000 --build-arg NEW_GID=1000 --build-arg IMAGE_USER=spark /home/ostrock/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[2024-05-18T17:59:44.376Z] [+] Building 0.0s (0/0)  docker:default
[2024-05-18T17:59:44.449Z] 
[2024-05-18T17:59:44.449Z] [+] Building 0.0s (0/1)                                          docker:default
[2024-05-18T17:59:44.681Z] 
[2024-05-18T17:59:44.681Z] [+] Building 0.2s (4/5)                                          docker:default
 => [internal] load build definition from updateUID.Dockerfile-0.59.1      0.0s
 => => transferring dockerfile: 1.36kB                                     0.0s
 => [internal] load metadata for docker.io/library/vsc-spark-devcontainer  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [1/2] FROM docker.io/library/vsc-spark-devcontainer-33625aaf6e3f871ea  0.0s
 => [2/2] RUN eval $(sed -n "s/spark:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^  0.2s
[2024-05-18T17:59:44.785Z] [+] Building 0.3s (4/5)                                          docker:default
[2024-05-18T17:59:44.785Z] 
 => [internal] load build definition from updateUID.Dockerfile-0.59.1      0.0s
 => => transferring dockerfile: 1.36kB                                     0.0s
 => [internal] load metadata for docker.io/library/vsc-spark-devcontainer  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [1/2] FROM docker.io/library/vsc-spark-devcontainer-33625aaf6e3f871ea  0.0s
 => [2/2] RUN eval $(sed -n "s/spark:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^  0.3s
 => => # Updating UID:GID from 185:185 to 1000:1000.                           
[2024-05-18T17:59:44.882Z] [+] Building 0.4s (5/5) FINISHED                                 docker:default
 => [internal] load build definition from updateUID.Dockerfile-0.59.1      0.0s
[2024-05-18T17:59:44.882Z]  => => transferring dockerfile: 1.36kB                                     0.0s
 => [internal] load metadata for docker.io/library/vsc-spark-devcontainer  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [1/2] FROM docker.io/library/vsc-spark-devcontainer-33625aaf6e3f871ea  0.0s
 => ERROR [2/2] RUN eval $(sed -n "s/spark:[^:]*:\([^:]*\):\([^:]*\):[^:]  0.3s
                                                                                
------
 > [2/2] RUN eval $(sed -n "s/spark:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); 	eval $(sed -n "s/\([^:]*\):[^:]*:1000:.*/EXISTING_USER=\1/p" /etc/passwd); 	eval $(sed -n "s/\([^:]*\):[^:]*:1000:.*/EXISTING_GROUP=\1/p" /etc/group); 	if [ -z "$OLD_UID" ]; then 		echo "Remote user not found in /etc/passwd (spark)."; 	elif [ "$OLD_UID" = "1000" -a "$OLD_GID" = "1000" ]; then 		echo "UIDs and GIDs are the same (1000:1000)."; 	elif [ "$OLD_UID" != "1000" -a -n "$EXISTING_USER" ]; then 		echo "User with UID exists ($EXISTING_USER=1000)."; 	else 		if [ "$OLD_GID" != "1000" -a -n "$EXISTING_GROUP" ]; then 			echo "Group with GID exists ($EXISTING_GROUP=1000)."; 			NEW_GID="$OLD_GID"; 		fi; 		echo "Updating UID:GID from $OLD_UID:$OLD_GID to 1000:1000."; 		sed -i -e "s/\(spark:[^:]*:\)[^:]*:[^:]*/\11000:1000/" /etc/passwd; 		if [ "$OLD_GID" != "1000" ]; then 			sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\11000:/" /etc/group; 		fi; 		chown -R 1000:1000 $HOME_FOLDER; 	fi;:
0.255 Updating UID:GID from 185:185 to 1000:1000.
0.261 chown: cannot access '/home/spark': No such file or directory
------
[2024-05-18T17:59:44.885Z] updateUID.Dockerfile-0.59.1:10
--------------------
   9 |     SHELL ["/bin/sh", "-c"]
  10 | >>> RUN eval $(sed -n "s/${REMOTE_USER}:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); \
  11 | >>> 	eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\1/p" /etc/passwd); \
  12 | >>> 	eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\1/p" /etc/group); \
  13 | >>> 	if [ -z "$OLD_UID" ]; then \
  14 | >>> 		echo "Remote user not found in /etc/passwd ($REMOTE_USER)."; \
  15 | >>> 	
[2024-05-18T17:59:44.885Z] elif [ "$OLD_UID" = "$NEW_UID" -a "$OLD_GID" = "$NEW_GID" ]; then \
  16 | >>> 		echo "UIDs and GIDs are the same ($NEW_UID:$NEW_GID)."; \
  17 | >>> 	elif [ "$OLD_UID" != "$NEW_UID" -a -n "$EXISTING_USER" ]; then \
  18 | >>> 		echo "User with UID exists ($EXISTING_USER=$NEW_UID)."; \
  19 | >>> 	else \
  20 | >>> 		if [ "$OLD_GID" != "$NEW_GID" -a -n "$EXISTING_GROUP" ]; then \
  21 | >>> 			echo "Group with GID exists ($EXISTING_GROUP=$NEW_GID)."; \
  22 | >>> 			NEW_GID="$OLD_GID"; \
  23 | >>> 		fi; \
  24 | >>> 		echo "Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID."; \
  25 | >>> 		sed -i -e "s/\(${REMOTE_USER}:[^:]*:\)[^:]*:[^:]*/\1${NEW_UID}:${NEW_GID}/" /etc/passwd; \
  26 | >>> 		if [ "$OLD_GID" != "$NEW_GID" ]; then \
  27 | >>> 			sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\1${NEW_GID}:/" /etc/group; \
  28 | >>> 		fi; \
  29 | >>> 		chown -R $NEW_UID:$NEW_GID $HOME_FOLDER; \
  30 | >>> 	fi;
  31 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c eval $(sed -n \"s/${REMOTE_USER}:[^:]*:\\([^:]*\\):\\([^:]*\\):[^:]*:\\([^:]*\\).*/OLD_UID=\\1;OLD_GID=\\2;HOME_FOLDER=\\3/p\" /etc/passwd); \teval $(sed -n \"s/\\([^:]*\\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\\1/p\" /etc/passwd); \teval $(sed -n \"s/\\([^:]*\\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\\1/p\" /etc/group); \tif [ -z \"$OLD_UID\" ]; then \t\techo \"Remote user not found in /etc/passwd ($REMOTE_USER).\"; \telif [ \"$OLD_UID\" = \"$NEW_UID\" -a \"$OLD_GID\" = \"$NEW_GID\" ]; then \t\techo \"UIDs and GIDs are the same ($NEW_UID:$NEW_GID).\"; \telif [ \"$OLD_UID\" != \"$NEW_UID\" -a -n \"$EXISTING_USER\" ]; then \t\techo \"User with UID exists ($EXISTING_USER=$NEW_UID).\"; \telse \t\tif [ \"$OLD_GID\" != \"$NEW_GID\" -a -n \"$EXISTING_GROUP\" ]; then \t\t\techo \"Group with GID exists ($EXISTING_GROUP=$NEW_GID).\"; \t\t\tNEW_GID=\"$OLD_GID\"; \t\tfi; \t\techo \"Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID.\"; \t\tsed -i -e \"s/\\(${REMOTE_USER}:[^:]*:\\)[^:]*:[^:]*/\\1${NEW_UID}:${NEW_GID}/\" /etc/passwd; \t\tif [ \"$OLD_GID\" != \"$NEW_GID\" ]; then \t\t\tsed -i -e \"s/\\([^:]*:[^:]*:\\)${OLD_GID}:/\\1${NEW_GID}:/\" /etc/group; \t\tfi; \t\tchown -R $NEW_UID:$NEW_GID $HOME_FOLDER; \tfi;" did not complete successfully: exit code: 1
[2024-05-18T17:59:44.892Z] Stop (790 ms): Run: docker build -f /tmp/devcontainercli-ostrock/updateUID.Dockerfile-0.59.1 -t vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453-uid --platform linux/amd64 --build-arg BASE_IMAGE=vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453 --build-arg REMOTE_USER=spark --build-arg NEW_UID=1000 --build-arg NEW_GID=1000 --build-arg IMAGE_USER=spark /home/ostrock/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[2024-05-18T17:59:44.893Z] Error: Command failed: docker build -f /tmp/devcontainercli-ostrock/updateUID.Dockerfile-0.59.1 -t vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453-uid --platform linux/amd64 --build-arg BASE_IMAGE=vsc-spark-devcontainer-33625aaf6e3f871ea5f5825e2c1bc1653b9b958d88757dde90e59dc791623453 --build-arg REMOTE_USER=spark --build-arg NEW_UID=1000 --build-arg NEW_GID=1000 --build-arg IMAGE_USER=spark /home/ostrock/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[2024-05-18T17:59:44.894Z]     at ptA (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:464:1260)
[2024-05-18T17:59:44.894Z]     at NH (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:464:1002)
[2024-05-18T17:59:44.895Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-05-18T17:59:44.895Z]     at async KtA (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:481:3692)
[2024-05-18T17:59:44.895Z]     at async $C (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:481:4807)
[2024-05-18T17:59:44.895Z]     at async hrA (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:661:13255)
[2024-05-18T17:59:44.895Z]     at async lrA (/home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js:661:12996)
[2024-05-18T17:59:44.915Z] Stop (133253 ms): Run: /usr/share/code/code /home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/ostrock/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-ebf2d76f-5b28-4a53-abbe-df813da930761716055048947 --workspace-folder /home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer --id-label devcontainer.config_file=/home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[2024-05-18T17:59:44.916Z] Exit code 1
[2024-05-18T17:59:44.934Z] Command failed: /usr/share/code/code /home/ostrock/.vscode/extensions/ms-vscode-remote.remote-containers-0.362.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/ostrock/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-ebf2d76f-5b28-4a53-abbe-df813da930761716055048947 --workspace-folder /home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer --id-label devcontainer.config_file=/home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/ostrock/Insync/guilherme@ostrock.com.br/OneDrive/Code/spark-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[2024-05-18T17:59:44.934Z] Exit code 1

@ThomasOwens
Copy link
Author

I'm wondering if this was a Docker issue. I noticed a Docker update to 4.30.0. After installing that, I can't reproduce this issue anymore. Nothing is obvious in the release notes, but it seems like the only relevant change since I didn't apply any updates to VS Code or any plugins.

I'll leave this open in case there is an investigation or something else to do, but it does look like my problem is resolved (for now).

@chrmarti
Copy link
Contributor

@ThomasOwens It was complaining that the container wasn't running, maybe the entrypoint's process exited unexpectedly?

@Ostrock This looks like an issue with your Dockerfile: 0.261 chown: cannot access '/home/spark': No such file or directory

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

No branches or pull requests

4 participants