Outline
Shortening the Command
Using --volume
or -v
requires a full path, which can become very long. You can shorten the paths to the working directory by replacing the directories before your file with $(pwd)
for "print working directory." For example:
$ docker container run -v /some/extremely_long/directory/path/myfile.html : /var/www/html:ro -p 80:80 nginx:latest # before
$ docker container run -v $(pwd)/myfile.html : /var/www/html:ro -p 80:80 nginx:latest # after
Note: This trick varies with operating systems.