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

Can't use NVM in a custom command with exec_target specified. #1813

Open
ekubovsky opened this issue Feb 15, 2024 · 0 comments
Open

Can't use NVM in a custom command with exec_target specified. #1813

ekubovsky opened this issue Feb 15, 2024 · 0 comments

Comments

@ekubovsky
Copy link

Description
I am attempting to use nvm in the CLI container. When using custom command with exec_target = cli option - it reports that nvm is not found. At the same time when fin exec ... - works as expected.

Are commands executed in a different context?

Steps to reproduce the issue:

  1. Initialize a default Docksal project.

  2. Create a custom command with exec target:

    #!/usr/bin/env bash
    #: exec_target = cli
    # Abort if anything fails
    set -e
    nvm --version
    
  3. Run the command, the following error is reported:

    /var/www/.docksal/commands/custom-command: line 5: nvm: command not found
    
  4. Run fin exec nvm --version - no error reported:

    > fin exec nvm --version
    0.39.5
    
  5. Run the same command inside fin bash - it works as well:

    > fin bash
    docker@cli:/var/www$ nvm --version
    0.39.5
    docker@cli:/var/www$
    

Describe the results you received:

Received an error message - /var/www/.docksal/commands/custom-command: line 5: nvm: command not found

Describe the results you expected:

Expected nvm to be working as normal.

Output of fin config:

fin config output
---------------------
COMPOSE_PROJECT_NAME_SAFE: fin-test
COMPOSE_FILE:
/home/user1234/.docksal/stacks/volumes-bind.yml
/home/user1234/.docksal/stacks/stack-default.yml
/home/user1234/www/fin-test/.docksal/docksal.yml
ENV_FILE:
/home/user1234/www/fin-test/.docksal/docksal.env

PROJECT_ROOT: /home/user1234/www/fin-test
DOCROOT: docroot
VIRTUAL_HOST: fin-test.docksal.site
VIRTUAL_HOST_ALIASES: *.fin-test.docksal.site
IP: 192.168.64.100

MySQL endpoint: 192.168.64.100:58364
Public URL:

Docker Compose configuration
---------------------
name: fin-test
services:
  cli:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      BLACKFIRE_CLIENT_ID: null
      BLACKFIRE_CLIENT_TOKEN: null
      COMPOSER_ALLOW_XDEBUG: "0"
      COMPOSER_DEFAULT_VERSION: null
      COMPOSER_DISABLE_XDEBUG_WARN: "0"
      DOCROOT: docroot
      DRUSH_ALLOW_XDEBUG: "0"
      DRUSH_OPTIONS_URI: fin-test.docksal.site
      GIT_USER_EMAIL: user1234@example.com
      GIT_USER_NAME: User 1234
      HOST_GID: "1000"
      HOST_UID: "1000"
      MYSQL_DATABASE: default
      MYSQL_HOST: db
      MYSQL_PASSWORD: user
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      PHP_IDE_CONFIG: null
      SECRET_ACQUIA_CLI_KEY: null
      SECRET_ACQUIA_CLI_SECRET: null
      SECRET_PLATFORMSH_CLI_TOKEN: null
      SECRET_SSH_PRIVATE_KEY: null
      SECRET_TERMINUS_TOKEN: null
      SSH_AUTH_SOCK: /.ssh-agent/proxy-socket
      VIRTUAL_HOST: fin-test.docksal.site
      XDEBUG_CONFIG: client_host=192.168.64.1
      XDEBUG_ENABLED: "0"
    extends:
      file: /home/user1234/.docksal/stacks/services.yml
      service: cli
    hostname: cli
    healthcheck:
      interval: 10s
    image: docksal/cli:php8.1-3.3
    labels:
      io.docksal.shell: bash
      io.docksal.user: docker
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: docksal_ssh_agent
      target: /.ssh-agent
      read_only: true
      volume: {}
    - type: volume
      source: cli_home
      target: /home/docker
      volume: {}
    - type: bind
      source: /tmp/.docksal/fin-test
      target: /tmp/.docksal/fin-test
      read_only: true
      bind:
        create_host_path: true
    - type: volume
      source: project_root
      target: /var/www
      volume:
        nocopy: true
  db:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: null
      MYSQL_DATABASE: default
      MYSQL_INITDB_SKIP_TZINFO: null
      MYSQL_ONETIME_PASSWORD: null
      MYSQL_PASSWORD: user
      MYSQL_RANDOM_ROOT_PASSWORD: null
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
    extends:
      file: /home/user1234/.docksal/stacks/services.yml
      service: mariadb
    hostname: db
    healthcheck:
      interval: 10s
    image: docksal/mariadb:10.6-1.3
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    ports:
    - mode: ingress
      target: 3306
      protocol: tcp
    volumes:
    - type: volume
      source: db_data
      target: /var/lib/mysql
      volume: {}
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
  web:
    depends_on:
      cli:
        condition: service_started
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      APACHE_BASIC_AUTH_PASS: null
      APACHE_BASIC_AUTH_USER: null
      APACHE_DOCUMENTROOT: /var/www/docroot
      APACHE_FCGI_HOST_PORT: cli:9000
    extends:
      file: /home/user1234/.docksal/stacks/services.yml
      service: apache
    hostname: web
    healthcheck:
      interval: 10s
    image: docksal/apache:2.4-2.5
    labels:
      io.docksal.cert-name: none
      io.docksal.permanent: "false"
      io.docksal.project-root: /home/user1234/www/fin-test
      io.docksal.virtual-host: fin-test.docksal.site,*.fin-test.docksal.site,fin-test.docksal.site.*
    logging:
      options:
        max-file: "10"
        max-size: 1m
    networks:
      default: null
    volumes:
    - type: volume
      source: project_root
      target: /var/www
      read_only: true
      volume:
        nocopy: true
networks:
  default:
    name: fin-test_default
volumes:
  cli_home:
    name: fin-test_cli_home
  db_data:
    name: fin-test_db_data
  docksal_ssh_agent:
    name: docksal_ssh_agent
    external: true
  project_root:
    name: fin-test_project_root
    driver: local
    driver_opts:
      device: /home/user1234/www/fin-test
      o: bind
      type: none
---------------------


Output of fin sysinfo:

fin sysinfo output

███  DOCKSAL
Docksal version: v1.18.2
fin version:     v1.113.2

███  OS
Linux Ubuntu 20.04
Linux Laptop 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

███  ENVIRONMENT
MODE : Linux Kernel
DOCKER_HOST : 

███  DOCKER
Expected client version: 20.10.23
Expected server version: 20.10.23

Installed versions:

Client:
Cloud integration: v1.0.35+desktop.10
Version:           25.0.2
API version:       1.44
Go version:        go1.21.6
Git commit:        29cf629
Built:             Thu Feb  1 00:22:06 2024
OS/Arch:           linux/amd64
Context:           default

Server: Docker Desktop
Engine:
Version:          25.0.2
API version:      1.44 (minimum version 1.24)
Go version:       go1.21.6
Git commit:       fce6e0c
Built:            Thu Feb  1 00:23:17 2024
OS/Arch:          linux/amd64
Experimental:     false
containerd:
Version:          1.6.28
GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version:          1.1.12
GitCommit:        v1.1.12-0-g51d5e94
docker-init:
Version:          0.19.0
GitCommit:        de40ad0

███  DOCKER COMPOSE
Expected version:  2.15.1
Installed version: 2.15.1

███  DOCKSAL: PROJECTS
project    STATUS                         virtual host                                                            project root
fin-test   Up 10 minutes (healthy)        fin-test.docksal.site,*.fin-test.docksal.site,fin-test.docksal.site.*   /home/user1234/www/fin-test

███  DOCKSAL: VIRTUAL HOSTS
*.fin-test.docksal.site
fin-test.docksal.site.*
fin-test.docksal.site

███  DOCKSAL: NETWORKING

DOCKSAL_IP: 192.168.64.100
DOCKSAL_HOST_IP: 192.168.64.1
DOCKSAL_VHOST_PROXY_IP: 
DOCKSAL_DNS_IP: 
DOCKSAL_DNS_DISABLED: 1
DOCKSAL_NO_DNS_RESOLVER: 1
DOCKSAL_DNS_UPSTREAM: 
DOCKSAL_DNS_DOMAIN: docksal.site

███  DOCKSAL: CONNECTIVITY

Host to 192.168.64.100: 	PASS
Container to 192.168.64.100: 	FAIL
Container to 192.168.64.1: 	FAIL

Checking connectivity to http://dns-test.docksal.site...
Host: PASS
Containers: PASS

███  DOCKER: RUNNING CONTAINERS
CONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS                    PORTS                                                    NAMES
55cbee655b7c   docksal/ssh-agent:1.4      "docker-entrypoint.s…"   27 minutes ago   Up 27 minutes (healthy)                                                            docksal-ssh-agent
362048c48511   docksal/vhost-proxy:1.8    "docker-entrypoint.s…"   27 minutes ago   Up 27 minutes (healthy)   192.168.64.100:80->80/tcp, 192.168.64.100:443->443/tcp   docksal-vhost-proxy
e59433f79de1   docksal/apache:2.4-2.5     "httpd-foreground"       3 days ago       Up 10 minutes (healthy)   80/tcp, 443/tcp                                          fin-test_web_1
77935502608d   docksal/cli:php8.1-3.3     "/opt/startup.sh sup…"   3 days ago       Up 10 minutes (healthy)   22/tcp, 3000/tcp, 9000/tcp                               fin-test_cli_1
e998185a03b0   docksal/mariadb:10.6-1.3   "docker-entrypoint.s…"   3 days ago       Up 10 minutes (healthy)   0.0.0.0:58364->3306/tcp                                  fin-test_db_1

███  DOCKER: NETWORKS
NETWORK ID     NAME               DRIVER    SCOPE
926ca56760d2   _default           bridge    local
f131131b76fc   bridge             bridge    local
2f4acebdaeff   fin-test_default   bridge    local
efd886389ad7   host               host      local
6cdd331e4255   none               null      local

███  DOCKER DESKTOP
EXPECTED VERSION: 4.17.0
DETECTED VERSION: 

███  HDD Usage
Filesystem                                Size  Used Avail Use% Mounted on
none                                      7.8G  4.0K  7.8G   1% /mnt/wsl
/dev/sdd                                 1007G   25G  932G   3% /mnt/wsl/docker-desktop-data/isocache
none                                      7.8G  8.0K  7.8G   1% /mnt/wsl/docker-desktop/shared-sockets/host-services
/dev/sdc                                 1007G   62M  956G   1% /mnt/wsl/docker-desktop/docker-desktop-user-distro
/dev/loop0                                457M  457M     0 100% /mnt/wsl/docker-desktop/cli-tools
none                                      1.1T  113G  912G  12% /usr/lib/wsl/drivers
/dev/sde                                 1007G  4.9G  951G   1% /
none                                      7.8G   84K  7.8G   1% /mnt/wslg
none                                      7.8G     0  7.8G   0% /usr/lib/wsl/lib
rootfs                                    7.8G  2.1M  7.8G   1% /init
none                                      7.8G     0  7.8G   0% /dev
none                                      7.8G  8.0K  7.8G   1% /run
none                                      7.8G     0  7.8G   0% /run/lock
none                                      7.8G     0  7.8G   0% /run/shm
none                                      7.8G     0  7.8G   0% /run/user
tmpfs                                     7.8G     0  7.8G   0% /sys/fs/cgroup
none                                      7.8G   76K  7.8G   1% /mnt/wslg/versions.txt
none                                      7.8G   76K  7.8G   1% /mnt/wslg/doc
C:\                                       1.1T  113G  912G  12% /mnt/c
D:\                                       193G  100M  192G   1% /mnt/d
E:\                                       690G   33G  658G   5% /mnt/e
C:\Program Files\Docker\Docker\resources  1.1T  113G  912G  12% /Docker/host

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

1 participant