This is what you wrote
docker run -it --rm -p 8000:8000 -v sqlite:/sqlite -v ${pwd}/website:/usr/src/website insightwrite:master python manage.py runserver 0.0.0.0:8000
And this is on GitHub
docker run -it --rm -p 8000:8000 -v sqlite:/sqlite -v $(pwd)/website:/usr/src/website django-docker-template:master python manage.py runserver 0.0.0.0:8000
Notice the difference in ${pwd}
which would try to refer to an environment variable and not run a command in a subshell. The same value is in $PWD
as well, but that is upper case. With your syntax you get an empty variable as it is probably undefined, but that shouldn’t cause invalid reference format, just mount the wrong directory. So maybe there is something in that variable but not the right one. Fix the parenthesis in your command and that should work.
I almost missed it, because it is harder to notice it in your post. Please, always use code blocks for codes, terminal outputs and logs. More information in the formatting guide: How to format your forum posts
If fixing the parenthesis doesn’t help, you can also quote the path.
docker run -it --rm -p 8000:8000 -v sqlite:/sqlite -v "$(pwd)/website:/usr/src/website" insightwrite:master python manage.py runserver 0.0.0.0:8000
which helps if your working directory has space in its path. I don’t see other problem in the command, but invalid reference format indicates the image name is invalid. That can happen when something before the image name is incorrect and that something else is interpreted as an image name while the actual image name becomes an argument for example. Or the image name becomes a volume and an argument is interpreted as image name.
If you have space in ${pwd}
, than the result could be something like this:
docker run -it --rm -p 8000:8000 -v sqlite:/sqlite -v /Users/my user/folder/website:/usr/src/website insightwrite:master python manage.py runserver 0.0.0.0:8000
As you see, /Users/my
becomes an anonymous volume’s mount point and user/folder/website:/usr/src/website
becomes the image tag, but slashes are not supported in the version tag so you get “invalid reference error”