Docker says file doesn't exist but it appears in docker shell

Viewed 25

I'm been bashing my head against the wall for hours trying to figure this out. I'm getting an You have $NVM_DIR set to "/usr/local/nvm", but that directory does not exist error from docker, but when I docker exec -it <container> bash into the container, I can see /usr/local/nvm clear as day.

I've got my Dockerfile below, as well as the docker-compose.yml and the output from the docker compose build step.

Dockerfile (up until error)

FROM rust:1.63 as runner

# Install Node and NPM with NVM
ENV NVM_DIR /usr/local/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
ENV NODE_VERSION v18.9.0
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"

docker-compose.yml

version: '3.8'
services:
  app:
    ports:
      - '8001:8001'
    image: library/rustapp
    build:
      context: .
      dockerfile: Dockerfile.dev
    environment:
      ROCKET_ADDRESS: '0.0.0.0'
      PORT: 8001
      ENVIRONMENT: STAGING
    volumes:
      - ${PWD}/frontend/:/home/app/frontend

Output of docker compose build

[+] Building 0.3s (6/12)                                                                                                                                                    
 => [internal] load build definition from Dockerfile.dev                                                                                                               0.0s
 => => transferring dockerfile: 36B                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 34B                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/rust:1.63                                                                                                           0.0s
 => ERROR FROM docker.io/library/rusty-builder:latest                                                                                                                  0.2s
 => => resolve docker.io/library/rusty-builder:latest                                                                                                                  0.2s
 => CACHED [runner 1/8] FROM docker.io/library/rust:1.63                                                                                                               0.0s
 => ERROR [runner 2/8] RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash                                                             0.2s
------
 > FROM docker.io/library/rusty-builder:latest:
------
------
 > [runner 2/8] RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash:
#0 0.140   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 0.140                                  Dload  Upload   Total   Spent    Left  Speed
100 15037  100 15037    0     0   183k      0 --:--:-- --:--:-- --:--:--  183k
#0 0.227 You have $NVM_DIR set to "/usr/local/nvm", but that directory does not exist. Check your profile files and environment.
------
failed to solve: failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
0 Answers
Related