Skip to content

[BUG]: Unable to configure vfox correctly in Dockerfile #638

@linghengqian

Description

@linghengqian

Version
The version you are currently using

OS
macOS、Linux、Windows

  • Linux

Describe the bug
A clear and concise description of what the bug is.

  • Unable to configure vfox correctly in Dockerfile.
  • For Ubuntu 24.04 WSL, assuming Docker Engine 29.1.3 is installed. First create the /tmp/compose.yaml file.
name: myapp
services:
  agent-custom:
    image: linghengqian/agent-custom:latest
    pull_policy: build
    build:
      context: .
      dockerfile_inline: |
        FROM ubuntu:noble-20260210.1
        SHELL ["/bin/bash", "-c"]
        ENV VFOX_NODEJS_MIRROR="https://cdn.npmmirror.com/binaries/node"
        RUN apt update
        RUN apt install --assume-yes curl
        RUN curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash \
          && echo 'eval "$$(vfox activate bash)"' >> $$HOME/.bashrc \
          && source $$HOME/.bashrc \
          && vfox add nodejs \
          && vfox install nodejs@24.14.0 \
          && vfox use --global nodejs@24.14.0 \
          && npm install -g @qwen-code/qwen-code@latest \
          && npm install -g opencode-ai@latest
  • Executing docker compose -f /tmp/compose.yaml up -d will result in an error when building the Docker image.
lingh@DESKTOP-58BHAE6:/tmp$ docker compose -f /tmp/compose.yaml up -d
[+] Building 11.8s (8/8) FINISHED
 => [internal] load local bake definitions                                                                         0.0s
 => => reading from stdin 1.13kB                                                                                   0.0s
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 573B                                                                               0.0s
 => [internal] load metadata for docker.io/library/ubuntu:noble-20260210.1                                         1.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [1/4] FROM docker.io/library/ubuntu:noble-20260210.1@sha256:d1e2e92c075e5ca139d51a140fff46f84315c0fdce203eab2  0.0s
 => => resolve docker.io/library/ubuntu:noble-20260210.1@sha256:d1e2e92c075e5ca139d51a140fff46f84315c0fdce203eab2  0.0s
 => CACHED [2/4] RUN apt update                                                                                    0.0s
 => CACHED [3/4] RUN apt install --assume-yes curl                                                                 0.0s
 => ERROR [4/4] RUN curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash   && ech  10.6s
------
 > [4/4] RUN curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash   && echo 'eval "$(vfox activate bash)"' >> $HOME/.bashrc   && source $HOME/.bashrc   && vfox add nodejs   && vfox install nodejs@24.14.0   && vfox use --global nodejs@24.14.0   && npm install -g @qwen-code/qwen-code@latest   && npm install -g opencode-ai@latest:
0.849 Installing vfox v1.0.6 ...
0.852 https://github.com/version-fox/vfox/releases/download/v1.0.6/vfox_1.0.6_linux_x86_64.tar.gz
0.859   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
0.859                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 5277k  100 5277k    0     0  2724k      0  0:00:01  0:00:01 --:--:-- 12.6M
2.905 vfox_1.0.6_linux_x86_64/LICENSE
2.906 vfox_1.0.6_linux_x86_64/README.md
2.906 vfox_1.0.6_linux_x86_64/completions/bash_autocomplete
2.907 vfox_1.0.6_linux_x86_64/completions/powershell_autocomplete.ps1
2.907 vfox_1.0.6_linux_x86_64/completions/zsh_autocomplete
2.907 vfox_1.0.6_linux_x86_64/vfox
2.990 vfox installed successfully!
3.003 Fetching nodejs manifest...
3.781 Downloading vfox-nodejs-0.4.1.zip...
3.784 Validating /root/.vfox/plugin/vfox-nodejs-0.4.1.zip ...
3.786 Plugin info:
3.786 Name     -> nodejs
3.786 Version  -> 0.4.1
3.786 Homepage -> https://github.com/version-fox/vfox-nodejs
3.786 Desc     -> Node.js runtime environment.
3.786 Add nodejs plugin successfully!
3.786 Please use `vfox install nodejs@<version>` to install the version you need.
3.905 Preinstalling nodejs@24.14.0...
Downloading... 100% [======================================] (8.8 MB/s)
8.538 Verifying checksum dbf5b8665dec15e59e6359a517fefb47b23fdb9152d8def975b9bca3dfc6d355...
8.627 Unpacking /root/.vfox/cache/nodejs/node-v24.14.0-linux-x64.tar.gz...
10.37 Install nodejs@24.14.0 success!
10.37 Please use `vfox use nodejs@24.14.0` to use it.
10.39 vfox requires hook support. Please ensure vfox is properly initialized with 'vfox activate'
------
[+] up 0/1
 ⠙ Image linghengqian/agent-custom:latest Building                                                                13.6s
Dockerfile:6

--------------------

   5 |     RUN apt install --assume-yes curl

   6 | >>> RUN curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash \

   7 | >>>   && echo 'eval "$(vfox activate bash)"' >> $HOME/.bashrc \

   8 | >>>   && source $HOME/.bashrc \

   9 | >>>   && vfox add nodejs \

  10 | >>>   && vfox install nodejs@24.14.0 \

  11 | >>>   && vfox use --global nodejs@24.14.0 \

  12 | >>>   && npm install -g @qwen-code/qwen-code@latest \

  13 | >>>   && npm install -g opencode-ai@latest

  14 |

--------------------

failed to solve: process "/bin/bash -c curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash   && echo 'eval \"$(vfox activate bash)\"' >> $HOME/.bashrc   && source $HOME/.bashrc   && vfox add nodejs   && vfox install nodejs@24.14.0   && vfox use --global nodejs@24.14.0   && npm install -g @qwen-code/qwen-code@latest   && npm install -g opencode-ai@latest" did not complete successfully: exit code: 1

lingh@DESKTOP-58BHAE6:/tmp$
  • In contrast, if vfox is replaced with nvm-sh/nvm, everything works normally.
name: myapp
services:
  agent-custom:
    image: linghengqian/agent-custom:latest
    pull_policy: build
    build:
      context: .
      dockerfile_inline: |
        FROM ubuntu:noble-20260210.1
        SHELL ["/bin/bash", "-c"]
        ENV NVM_NODEJS_ORG_MIRROR="https://cdn.npmmirror.com/binaries/node"
        RUN apt update
        RUN apt install --assume-yes curl
        RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash \
          && source "$$HOME/.nvm/nvm.sh" \
          && nvm install 24.14.0 \
          && npm install -g @qwen-code/qwen-code@latest \
          && npm install -g opencode-ai@latest
lingh@DESKTOP-58BHAE6:/tmp$ docker compose -f /tmp/compose.yaml up -d
[+] Building 97.7s (10/10) FINISHED
 => [internal] load local bake definitions                                                                         0.0s
 => => reading from stdin 956B                                                                                     0.0s
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 447B                                                                               0.0s
 => [internal] load metadata for docker.io/library/ubuntu:noble-20260210.1                                         1.5s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => CACHED [1/4] FROM docker.io/library/ubuntu:noble-20260210.1@sha256:d1e2e92c075e5ca139d51a140fff46f84315c0fdce  0.0s
 => => resolve docker.io/library/ubuntu:noble-20260210.1@sha256:d1e2e92c075e5ca139d51a140fff46f84315c0fdce203eab2  0.0s
 => [2/4] RUN apt update                                                                                          10.1s
 => [3/4] RUN apt install --assume-yes curl                                                                        8.8s
 => [4/4] RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash   && source "$HOME  56.0s
 => exporting to image                                                                                            20.9s
 => => exporting layers                                                                                           17.3s
 => => exporting manifest sha256:ea0afb8c97243863d97c1ee992600f0bc9128c719dd4e60b259aaea2ddcfaf2c                  0.0s
 => => exporting config sha256:662708f19e4ce7c612bd892ba26c91b763f12823d4d67c9414089335a3003c76                    0.0s
 => => exporting attestation manifest sha256:81256508db6d6314c091f623b21ab9e41307cfd8cab00536efdd85b9c618ee70      0.0s
 => => exporting manifest list sha256:76a0d55d54b6071d8726f8e75a30f6ff3506970f68703afd833f4852f47719a2             0.0s
 => => naming to docker.io/linghengqian/agent-custom:latest                                                        0.0s
 => => unpacking to docker.io/linghengqian/agent-custom:latest                                                     3.5s
 => resolving provenance for metadata file                                                                         0.0s
[+] up 3/3
 ✔ Image linghengqian/agent-custom:latest Built                                                                  105.0s
 ✔ Network myapp_default                  Created                                                                  0.0s
 ✔ Container myapp-agent-custom-1         Created                                                                  0.5s
lingh@DESKTOP-58BHAE6:/tmp$

Screenshots[optional]
If applicable, add screenshots to help explain your problem.

  • This doesn't seem important.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions