linuxserver / docker-mods

Documentation and Examples of base container modifications
GNU General Public License v3.0
1.1k stars 283 forks source link

[BUG] `command not found: poetry` with mod `code-server-python3-poetry` #977

Open jo-chemla opened 22 hours ago

jo-chemla commented 22 hours ago

Is there an existing issue for this?

Name of mod

code-server-python3-poetry

Name of base container

lscr.io/linuxserver/code-server

Current Behavior

I tried the recent https://github.com/linuxserver/docker-mods/issues/958 code-server-python3-poetry dockermod by @howardt12345 but it seems that poetry is not installed in my setup, since running the following command either in container or code-server console returns: command not found: poetry

Running python3 does succeed.

I also tried restarting the container or re-running compose multiple times, but poetry is never found in path. The whole logs are in the dedicated section, below is the section regarding poetry.

**** Setting up poetry ****
Retrieving Poetry metadata
The latest version (1.8.4) is already installed.
**** ensuring poetry is in PATH ****
**** poetry setup complete ****

Expected Behavior

According to https://github.com/linuxserver/docker-mods/pull/959 running poetry --version should succeed in returning poetry version number

Steps To Reproduce

  1. Run the following docker-compose hub
  2. Go to container console or code-server console
  3. run poetry --version
  4. returns command not found: poetry.

Environment

- OS: QNAP QTS
- How docker service was installed: via qnap ContainerStation, and docker-compose files are run via portainer.

CPU architecture

x86-64

Docker creation

Here is the docker-compose file: 

version: "3.5"
services:
  code-server:
    image: lscr.io/linuxserver/code-server:latest 
    container_name: code-server
    environment:
      - DEFAULT_WORKSPACE=/workspace
      - DOCKER_MODS=linuxserver/mods:code-server-python3-poetry|linuxserver/mods:universal-docker|linuxserver/mods:code-server-pnpm|linuxserver/mods:code-server-nodejs|linuxserver/mods:code-server-zsh|linuxserver/mods:code-server-nvm
    volumes:
      - /workspace/:/workspace
      - /config/frontends/vscode-server:/config

Container logs

The latest version (1.8.4) is already installed.

**** ensuring poetry is in PATH ****

**** poetry setup complete ****

[custom-init] No custom files found, skipping...

[mod-init] Running Docker Modification Logic

[mod-init] Adding linuxserver/mods:code-server-python3-poetry to container

[mod-init] linuxserver/mods:code-server-python3-poetry at sha256:c5c9cfc568722e3d9ad3aa5e337be7d338c5bd9bf35c5edd8b38a714c50462e0 has been previously applied skipping

[mod-init] Adding linuxserver/mods:universal-docker to container

[mod-init] linuxserver/mods:universal-docker at sha256:a9eb9c49cab4673e5b9bd56656c105eaa176fa06739c2239857a324f0c0deafc has been previously applied skipping

[mod-init] Adding linuxserver/mods:code-server-pnpm to container

[mod-init] linuxserver/mods:code-server-pnpm at sha256:8cba0c5fc8bec29efb313a7b6e46344c129fa03e33e0efcd4ce33e78e634f696 has been previously applied skipping

[mod-init] Adding linuxserver/mods:code-server-nodejs to container

[mod-init] linuxserver/mods:code-server-nodejs at sha256:ef89f02941b6d5e689adc42aab4db179b7178321fb6ded4ef3551273bb542579 has been previously applied skipping

[mod-init] Adding linuxserver/mods:code-server-zsh to container

[mod-init] linuxserver/mods:code-server-zsh at sha256:58692eb8b8c3321567196fd9f6e006cbffdfb8806fbe3679e3d44bdea5d19f9b has been previously applied skipping

[mod-init] Adding linuxserver/mods:code-server-nvm to container

[mod-init] linuxserver/mods:code-server-nvm at sha256:fe5f0bccdf91b275d401c619576a7635500917c4bf17564916f10d1107e13682 has been previously applied skipping

[migrations] started

[migrations] no migrations found

usermod: no changes

───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗

      ██║     ██╔════╝██║██╔═══██╗

      ██║     ███████╗██║██║   ██║

      ██║     ╚════██║██║██║   ██║

      ███████╗███████║██║╚██████╔╝

      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io

───────────────────────────────────────

To support LSIO projects visit:

https://www.linuxserver.io/donate/

───────────────────────────────────────

GID/UID

───────────────────────────────────────

User UID:    1000

User GID:    100

───────────────────────────────────────

Linuxserver.io version: 4.95.2-ls241

Build-date: 2024-11-12T17:43:39+00:00

───────────────────────────────────────

**** installing docker and docker compose ****

**** installing pnpm  ****

**** docker and docker-compose already installed, skipping ****

**** Please map /var/run/docker.sock for access to docker service on host. Alternatively you can manually define a remote host address with the docker cli option -H ****

**** zsh already installed, skipping ****

**** Oh My Zsh is already installed. You can update it via "omz update" in terminal. ****

**** python3 already installed ****

**** installing nodejs dev environment ****

**** Adding nodejs and yarn to package install list ****

[pkg-install-init] **** Installing all mod packages ****

Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease

Hit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease

Hit:3 http://archive.ubuntu.com/ubuntu noble-security InRelease

Hit:4 https://dl.yarnpkg.com/debian stable InRelease

Hit:5 https://deb.nodesource.com/node_16.x nodistro InRelease

==> Downloading pnpm binaries 9.12.3

Reading package lists... WARN  using --force I sure hope you know what you are doing

Copying pnpm CLI from /tmp/tmp.vwj3fltls9/pnpm to /config/.local/share/pnpm/pnpm

No changes to the environment were made. Everything is already up to date.

Reading package lists...

Building dependency tree...

Reading state information...

nodejs is already the newest version (18.19.1+dfsg-6ubuntu5).

yarn is already the newest version (1.22.22-1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

**** installing nvm ****

**** nvm already installed, skipping ****

**** Setting up poetry ****

Retrieving Poetry metadata

The latest version (1.8.4) is already installed.

**** ensuring poetry is in PATH ****

**** poetry setup complete ****

[custom-init] No custom files found, skipping...

[2024-11-13T09:28:56.279Z] info  code-server 4.95.2 fc97e248c354be27a054c182669a6984dd73cd41

[2024-11-13T09:28:56.366Z] info  Using user-data-dir /config/data

[2024-11-13T09:28:56.396Z] info  Using config file /config/.config/code-server/config.yaml

[2024-11-13T09:28:56.397Z] info  HTTP server listening on http://0.0.0.0:8443/

[2024-11-13T09:28:56.397Z] info    - Authentication is enabled

[2024-11-13T09:28:56.397Z] info      - Using password from $PASSWORD

[2024-11-13T09:28:56.397Z] info    - Not serving HTTPS

[2024-11-13T09:28:56.397Z] info  Session server listening on /config/data/code-server-ipc.sock

Connection to 127.0.0.1 8443 port [tcp/*] succeeded!

[ls.io-init] done.

[10:29:04] 

[10:29:04] Extension host agent started.

[10:29:13] [100.74.185.82][af0ae598][ExtensionHostConnection] Unknown reconnection token (never seen).

[10:29:31] [100.74.185.82][587545ff][ManagementConnection] Unknown reconnection token (never seen).

File not found: /app/code-server/lib/vscode/node_modules/vsda/rust/web/vsda.js

File not found: /app/code-server/lib/vscode/node_modules/vsda/rust/web/vsda_bg.wasm

[10:29:51] [100.74.185.82][78e9e170][ManagementConnection] New connection established.

[10:29:54] [100.74.185.82][69df0480][ExtensionHostConnection] New connection established.

[10:29:55] [100.74.185.82][69df0480][ExtensionHostConnection] <1616> Launched Extension Host Process.
jo-chemla commented 22 hours ago

It seems that only the alias is missing, since running $HOME/.local/bin/poetry --version does succeed from both container console and code-server console.

With the selection of mods I've used, here are - from the container cmd - the PATH variable from the container cmd and /var/run/s6/container_environment/PATH contents:

# DOCKER_MODS=linuxserver/mods:code-server-python3-poetry|linuxserver/mods:universal-docker|
# linuxserver/mods:code-server-pnpm|linuxserver/mods:code-server-nodejs|linuxserver/mods:code-server-zsh|
# linuxserver/mods:code-server-nvm

# tested echo $PATH && printenv PATH && env | /bin/grep PATH
> echo $PATH
/config/.nvm/versions/node/v23.2.0/bin:/config/.local/share/pnpm:/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

> cat /var/run/s6/container_environment/PATH
/command:/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.local/binroot

# Note zsh, nodejs have been added directly to /usr/bin/ so only poetry is missing

What's weird is that from code-server terminal poetry should be accessible since $HOME/.local/bin is part of $PATH, but yet poetry command is not found unless called via absolute path


> $ echo $PATH
/app/code-server/lib/vscode/bin/remote-cli:/config/.nvm/versions/node/v23.2.0/bin:/config/.local/share/pnpm:
/command:/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.local/bin
> $ ls $HOME/.local/bin
poetry
> $ $HOME/.local/bin/poetry --version
Poetry (version 1.8.4)
> $ poetry --version
bash: poetry: command not found

Looking at the PR and how path is handled below, it seems that this is done differently in poetry than eg

https://github.com/howardt12345/docker-mods/blob/955bd728dfe474af83de78c22967063403a927b8/root/etc/s6-overlay/s6-rc.d/init-mod-code-server-python3-poetry-install/run#L11

See alternatives way to set path

The issue might however come from another docker-mod that erases poetry but not the other due to the order of the modules being loaded - will try to pinpoint which one with more testing.