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

Docker file fails #15

Open
viperguynaz opened this issue Sep 15, 2022 · 2 comments
Open

Docker file fails #15

viperguynaz opened this issue Sep 15, 2022 · 2 comments

Comments

@viperguynaz
Copy link

viperguynaz commented Sep 15, 2022

I've tried this on three different Windows environments (Windows 10 & 11, WLS2, Node v16.16.0, latest Docker ), all with the same error. Basically looks like the copy from /library-scripts/ fails.

Log ------------------------

[94 ms] Remote-Containers 0.251.0 in VS Code 1.71.1 (e7f30e38c5a4efafeec8ad52861eb772a9ee4dfb).
[94 ms] Start: Resolving Remote
[116 ms] Setting up container for folder or workspace: c:\projects\swa-basic
[121 ms] Start: Check Docker is running
[122 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[321 ms] Server API version: 1.41
[323 ms] Start: Run: docker volume ls -q
[596 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\projects\swa-basic --filter label=vsch.quality=stable
[786 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\projects\swa-basic
[972 ms] Start: Run: C:\Users\viper\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\viper\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\projects\swa-basic --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\projects\swa-basic --log-level debug --log-format json --config c:\projects\swa-basic\.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
[1169 ms] remote-containers 0.251.0.
[1169 ms] Start: Run: docker buildx version
[1443 ms] Start: Resolving Remote
[1445 ms] Start: Run: git rev-parse --show-cdup
[1500 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\projects\swa-basic
[1666 ms] local container features stored at: c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\node_modules\vscode-dev-containers\container-features
[1668 ms] Start: Run: tar --no-same-owner -x -f -
[1740 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f c:\projects\swa-basic\.devcontainer\Dockerfile -t vsc-swa-basic-d3791a392f70e508dd2f9c004254904d --build-arg NODE_VERSION=16 --build-arg CORE_TOOLS_VERSION=4 c:\projects\swa-basic\.devcontainer

[+] Building 0.7s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 32B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for mcr.microsoft.com/azure-functions/python  0.0s
 => [1/3] FROM mcr.microsoft.com/azure-functions/python:4-python3.9-core-  0.0s
 => [internal] load build context                                          0.0s
 => => transferring context: 87B                                           0.0s
 => CACHED [2/3] COPY library-scripts/*.sh library-scripts/*.env /tmp/lib  0.0s
 => ERROR [3/3] RUN bash /tmp/library-scripts/node-debian.sh "/usr/local/  0.5s
------
 > [3/3] RUN bash /tmp/library-scripts/node-debian.sh "/usr/local/share/nvm" "16
" "${USERNAME}"     && su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh
 && nvm install 16 2>&1"     && su vscode -c "umask 0002 && npm install --cache
/tmp/empty-cache -g @azure/static-web-apps-cli"     && if [ 4 != "4" ]; then apt
-get remove -y azure-functions-core-tools-4 && apt-get update && apt-get install
 -y "azure-functions-core-tools-4"; fi     && apt-get clean -y && rm -rf /var/li
b/apt/lists/*:
#0 0.483 /tmp/library-scripts/node-debian.sh: line 11: $'\r': command not found
#0 0.484 /tmp/library-scripts/node-debian.sh: line 18: $'\r': command not found
: invalid optionbrary-scripts/node-debian.sh: line 19: set: -
#0 0.485 set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
#0 0.485 /tmp/library-scripts/node-debian.sh: line 20: $'\r': command not found
#0 0.486 /tmp/library-scripts/node-debian.sh: line 35: syntax error near unexpec
ted token `$'do\r''
#0 0.486 /tmp/library-scripts/node-debian.sh: line 35: `    for CURRENT_USER in
'{POSSIBLE_USERS[@]}; do
------
ERROR: failed to solve: executor failed running [/bin/sh -c bash /tmp/library-sc
ripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"     && su vsco
de -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION
} 2>&1"     && su vscode -c "umask 0002 && npm install --cache /tmp/empty-cache
-g @azure/static-web-apps-cli"     && if [ $CORE_TOOLS_VERSION != "4" ]; then ap
t-get remove -y azure-functions-core-tools-4 && apt-get update && apt-get instal
l -y "azure-functions-core-tools-${CORE_TOOLS_VERSION}"; fi     && apt-get clean
 -y && rm -rf /var/lib/apt/lists/*]: exit code: 2
[3229 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f c:\projects\swa-basic\.devcontainer\Dockerfile -t vsc-swa-basic-d3791a392f70e508dd2f9c004254904d --build-arg NODE_VERSION=16 --build-arg CORE_TOOLS_VERSION=4 c:\projects\swa-basic\.devcontainer
[3229 ms]     at OF (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:258:1490)
[3229 ms]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[3230 ms]     at async Wf (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:257:2801)
[3230 ms]     at async pb (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:257:1779)
[3230 ms]     at async DF (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:263:2006)
[3230 ms]     at async to (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:263:3110)
[3230 ms]     at async Ak (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:383:8108)
[3231 ms]     at async Ok (c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js:383:7864)
[3249 ms] Exit code 1
[3252 ms] Command failed: C:\Users\viper\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\viper\.vscode\extensions\ms-vscode-remote.remote-containers-0.251.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\viper\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\projects\swa-basic --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\projects\swa-basic --log-level debug --log-format json --config c:\projects\swa-basic\.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
[3252 ms] Exit code 1
@MDendura
Copy link

I had issues building the Dockerfile on Windows too. It seems like they got modified to use CRLF instead of just LF when I cloned with git. Modifying them back to use just LF fixed the issue I was having with docker build and running the dev container.

Maybe a gitattributes file would help in this case?

*.sh        eol=lf
Dockerfile  eol=lf

@stu0292
Copy link

stu0292 commented Jul 14, 2023

MDendura thanks!

I saved this as a .gitattributes in the .devcontainer folder and recloned the repo and tried the 'reopen in container' command. Seems to have fixed that issue. Now on to the next error...

.devcontainer/.gitattributes :

*.sh        eol=lf
Dockerfile  eol=lf

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