frigate icon indicating copy to clipboard operation
frigate copied to clipboard

Local VSCode Dev Container Fails

Open mitchross opened this issue 2 years ago • 11 comments

Describe the problem you are having

Tying to load local VS code dev container to contribute to code base.

Following the contribution guide. Already ran make.

Version

Dev Branch Jan 7 2023

Frigate config file

NA

Relevant log output

2023-01-08T02:28:34.962Z] [+] Building 2.7s (9/9) FINISHED                                                
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 157B                                          0.0s
 => [internal] load build definition from Dockerfile-with-features         0.0s
 => => transferring dockerfile: 11.99kB                                    0.0s
 => resolve image config for docker.io/docker/dockerfile:1.2               0.6s
 => CACHED docker-image://docker.io/docker/dockerfile:1.2@sha256:e2a8561e  0.0s
 => => resolve docker.io/docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2  0.0s
 => [internal] load build definition from Dockerfile-with-features         0.0s
[2023-01-08T02:28:34.963Z]  => [internal] load .dockerignore                                          0.0s
 => ERROR [internal] load metadata for docker.io/library/dev_container_fe  1.8s
 => CANCELED [internal] load metadata for docker.io/library/debian:11      1.8s
 => CANCELED [internal] load metadata for docker.io/library/debian:11-sli  1.8s
------
 > [internal] load metadata for docker.io/library/dev_container_feature_content_temp:latest:
------
failed to solve: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
[2023-01-08T02:28:34.975Z] Stop (3618 ms): Run: docker-compose --project-name frigate -f /Users/mitchross/Documents/Programming/frigate/docker-compose.yml -f /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1673144911356.yml build
[2023-01-08T02:28:34.976Z] Error: Command failed: docker-compose --project-name frigate -f /Users/mitchross/Documents/Programming/frigate/docker-compose.yml -f /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1673144911356.yml build
[2023-01-08T02:28:34.976Z]     at pF (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1850:431)
[2023-01-08T02:28:34.976Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-01-08T02:28:34.976Z]     at async foe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1850:2457)
[2023-01-08T02:28:34.977Z]     at async loe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1832:2396)
[2023-01-08T02:28:34.977Z]     at async Poe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:2301)
[2023-01-08T02:28:34.978Z]     at async Zf (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:3278)
[2023-01-08T02:28:34.978Z]     at async aue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15276)
[2023-01-08T02:28:34.978Z]     at async oue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15030)
[2023-01-08T02:28:34.985Z] Stop (9418 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.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 true
[2023-01-08T02:28:34.986Z] Exit code 1
[2023-01-08T02:28:34.993Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.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 true
[2023-01-08T02:28:34.993Z] Exit code 1

FFprobe output from your camera

NA

Frigate stats

BAS

Operating system

Other

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

NA

Any other information that may be helpful

Just Local Dev Container in Mac OS.

mitchross avatar Jan 08 '23 02:01 mitchross

If you're running on macOS you need to comment out the dev/dri and dev/usb lines for the device and volume mounts.

If you're running an m1 you also need to comment out the ov-converter in Dockerfile

NickM-27 avatar Jan 08 '23 02:01 NickM-27

Even when I comment out the usb line in docker compose, the VS code dev container fails to load.

NOTE - This is a issue with the vscode dev container

[2023-01-08T17:26:49.073Z] Dev Containers 0.266.1 in VS Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161). [2023-01-08T17:26:49.072Z] Start: Resolving Remote [2023-01-08T17:26:49.144Z] Setting up container for folder or workspace: /Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.153Z] Start: Check Docker is running [2023-01-08T17:26:49.156Z] Start: Run: docker version --format {{.Server.APIVersion}} [2023-01-08T17:26:49.408Z] Stop (252 ms): Run: docker version --format {{.Server.APIVersion}} [2023-01-08T17:26:49.409Z] Server API version: 1.41 [2023-01-08T17:26:49.409Z] Stop (256 ms): Check Docker is running [2023-01-08T17:26:49.410Z] Start: Run: docker volume ls -q [2023-01-08T17:26:49.605Z] Stop (195 ms): Run: docker volume ls -q [2023-01-08T17:26:49.622Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=/Users/mitchross/Documents/Programming/frigate --filter label=vsch.quality=stable [2023-01-08T17:26:49.746Z] Stop (124 ms): Run: docker ps -q -a --filter label=vsch.local.folder=/Users/mitchross/Documents/Programming/frigate --filter label=vsch.quality=stable [2023-01-08T17:26:49.747Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.860Z] Stop (113 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.861Z] Start: Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.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 true [2023-01-08T17:26:50.289Z] (node:94782) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. [2023-01-08T17:26:50.290Z] (Use Code Helper --trace-deprecation ... to show where the warning was created) [2023-01-08T17:26:50.292Z] @devcontainers/cli 0.25.2. Node.js v16.14.2. darwin 22.3.0 x64. [2023-01-08T17:26:50.292Z] Start: Run: docker buildx version [2023-01-08T17:26:50.494Z] Stop (202 ms): Run: docker buildx version [2023-01-08T17:26:50.495Z] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689 [2023-01-08T17:26:50.496Z] [2023-01-08T17:26:50.496Z] Start: Resolving Remote [2023-01-08T17:26:50.503Z] Running the initializeCommand from devcontainer.json...

[2023-01-08T17:26:50.503Z] Start: Run: /bin/sh -c .devcontainer/initialize.sh [2023-01-08T17:26:51.093Z] config/config.yml already exists, skipping initialization [2023-01-08T17:26:51.095Z] Stop (592 ms): Run: /bin/sh -c .devcontainer/initialize.sh [2023-01-08T17:26:51.096Z] [2023-01-08T17:26:51.097Z] Start: Run: docker-compose version --short [2023-01-08T17:26:51.295Z] Stop (198 ms): Run: docker-compose version --short [2023-01-08T17:26:51.295Z] Docker Compose version: 2.13.0 [2023-01-08T17:26:51.296Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=frigate --filter label=com.docker.compose.service=devcontainer [2023-01-08T17:26:51.485Z] Stop (189 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=frigate --filter label=com.docker.compose.service=devcontainer [2023-01-08T17:26:51.486Z] Start: Run: docker inspect --type container 0933e41210e1 [2023-01-08T17:26:51.619Z] Stop (133 ms): Run: docker inspect --type container 0933e41210e1 [2023-01-08T17:26:51.622Z] Start: Inspecting container [2023-01-08T17:26:51.623Z] Start: Run: docker inspect --type container 0933e41210e113809006117bee55e91530284d738958fa17a562c8c25f32549b [2023-01-08T17:26:51.781Z] Stop (158 ms): Run: docker inspect --type container 0933e41210e113809006117bee55e91530284d738958fa17a562c8c25f32549b [2023-01-08T17:26:51.781Z] Stop (159 ms): Inspecting container [2023-01-08T17:26:51.782Z] Start: Run in container: /bin/sh [2023-01-08T17:26:51.792Z] Start: Run in container: uname -m [2023-01-08T17:26:51.926Z] Stop (144 ms): Run in container: /bin/sh [2023-01-08T17:26:51.927Z] Shell server terminated (code: 126, signal: null) [2023-01-08T17:26:51.927Z] unable to find user vscode: no matching entries in passwd file [2023-01-08T17:26:51.926Z] Start: Run in container: cat /etc/passwd [2023-01-08T17:26:51.927Z] Stdin closed! [2023-01-08T17:26:51.928Z] Error: An error occurred setting up the container. [2023-01-08T17:26:51.928Z] at loe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1832:2820) [2023-01-08T17:26:51.928Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5) [2023-01-08T17:26:51.928Z] at async Poe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:2301) [2023-01-08T17:26:51.928Z] at async Zf (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:3278) [2023-01-08T17:26:51.928Z] at async aue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15276) [2023-01-08T17:26:51.928Z] at async oue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15030) [2023-01-08T17:26:51.936Z] Stop (2075 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.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 true [2023-01-08T17:26:51.937Z] Exit code 1 [2023-01-08T17:26:51.942Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.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 true [2023-01-08T17:26:51.942Z] Exit code 1

mitchross avatar Jan 08 '23 17:01 mitchross

There's multiple usb lines and also the dockerfile lines. I run on macOS and commenting those out works as expected

What mac are you running on? I run MacBook Pro M1 Pro 14"

NickM-27 avatar Jan 08 '23 17:01 NickM-27

x86 macbook pro .... which lines in docker file specifically? I see quite a bit of usb related items in the docker file and dont want to over comment out and break integrity of the image.

image

mitchross avatar Jan 08 '23 17:01 mitchross

that looks correct as far as comments go. Just remembered you may need to run docker buildx use default to fix a compatibility issue

NickM-27 avatar Jan 08 '23 17:01 NickM-27

also be sure that you are rebuilding the dev container in vscode and not just refreshing the window, refreshing the window will not bring in the new docker compose file

NickM-27 avatar Jan 08 '23 17:01 NickM-27

also be sure that you are rebuilding the dev container in vscode and not just refreshing the window, refreshing the window will not bring in the new docker compose file

is there a special command to rebuild dev container in vscode? Or are you just referring to running "Make"..

I'll also try "docker buildx use default" too ....

mitchross avatar Jan 08 '23 17:01 mitchross

Yes in the top menu there is the command palette menu which has the option to rebuild container. By the way running make in the CLI won't do anything, the dev container builds the image inside anyway.

NickM-27 avatar Jan 08 '23 17:01 NickM-27

Yes in the top menu there is the command palette menu which has the option to rebuild container. By the way running make in the CLI won't do anything, the dev container builds the image inside anyway.

Thanks.. I am following this verbatium.. does it need to be updated maybe?

image

mitchross avatar Jan 08 '23 17:01 mitchross

you are following the stable contributor docs which would be applicable for master. The dev branch has many changes and the contributor docs would be the preview docs https://deploy-preview-4055--frigate-docs.netlify.app/development/contributing

NickM-27 avatar Jan 08 '23 17:01 NickM-27

That might explain quite a bit... alright im trying rebuild container from command pallet.. I didnt know that was a thing till now...

mitchross avatar Jan 08 '23 17:01 mitchross

ok the combo of

usb comment out, docker buildx use default, and command pallet docker dev container rebuild resolved this. Thanks!

mitchross avatar Jan 08 '23 18:01 mitchross

Feel free to create a PR to update the docs.

NickM-27 avatar Jan 08 '23 18:01 NickM-27

Yea I think the web docs need updating too. There is no more npm start from what I can tell. Looks like the swtich to vite means we need to run ' npm run dev '

mitchross avatar Jan 08 '23 18:01 mitchross

@NickM-27 any tips for starting web local? Im getting CORS issues and 403 issues

mitchross avatar Jan 08 '23 19:01 mitchross

npm run dev should do it, then access on localhost:5173

NickM-27 avatar Jan 08 '23 19:01 NickM-27

image

mitchross avatar Jan 08 '23 19:01 mitchross

Did you start frigate by running python3 -m frigate

NickM-27 avatar Jan 08 '23 19:01 NickM-27

yup

mitchross avatar Jan 08 '23 19:01 mitchross

Is it still running (didn't error out)? I've never seen that when frigate is running.

NickM-27 avatar Jan 08 '23 19:01 NickM-27

image image image image

mitchross avatar Jan 08 '23 19:01 mitchross

weird, I'd make sure you don't have any firewalls up or anything, never had any issues with that. If you run curl http://localhost:5000/api what do you get?

NickM-27 avatar Jan 08 '23 19:01 NickM-27

@NickM-27

image

mitchross avatar Jan 08 '23 20:01 mitchross

Maybe restart vscode again, seems the nginx service may not the running or else there's some other issue not allowing access to that port.

NickM-27 avatar Jan 08 '23 20:01 NickM-27

Maybe restart vscode again, seems the nginx service may not the running or else there's some other issue not allowing access to that port.

Thats after a fresh restart ^

Docker hub shows no ports exposed for the dev container... Is the docker compose supposed to expose ports here? or even the vs code container? Cause they are definately not exposed outside docker.

mitchross avatar Jan 08 '23 20:01 mitchross

The ports are all defined here: https://github.com/blakeblackshear/frigate/blob/5b7cd9ce64df6032f97ef7b7f01e1da1fd287aa1/.devcontainer/devcontainer.json#L14

When I look in vscode I can see all the ports in the ports tab next to terminal

NickM-27 avatar Jan 08 '23 20:01 NickM-27

image

mitchross avatar Jan 08 '23 21:01 mitchross

image

mitchross avatar Jan 08 '23 21:01 mitchross

it seems 5000 / nginix is the issue? 5001 seems ok?

image

mitchross avatar Jan 08 '23 21:01 mitchross

interesting, not sure why nginx wouldn't be running

NickM-27 avatar Jan 08 '23 21:01 NickM-27