dockergit-bash

docker: invalid reference format using ${PWD} on WIndows


I want to run docker container (Windows) using the following shell file configuration:

# Variables
model="Llama-2-7b-chat"
volume="$PWD/data"

# Echo starting message
echo "Starting the Docker container with local files (No Internet): $model and volume: $volume ..."

# Start the Docker container
docker run --rm --entrypoint /bin/bash -itd \
  --name $model \
  -v $volume:/data \
  -p 8080:80 ghcr.io/huggingface/text-generation-inference:latest

When I start .sh script I get the following error:

$ ./run_llama_2.sh
Starting the Docker container with local files (No Internet): Llama-2-7b-chat and volume: /c/Users/user_name/llama_chat/data ...
docker: invalid reference format.

It has something to do with volume="$PWD/data". How can I correct the format?


Solution

  • You should expand your variables:

    $ docker run --rm --entrypoint /bin/bash -itd \
      --name "$model" \
      -v "$volume":/data \
      -p 8080:80 ghcr.io/huggingface/text-generation-inference:latest