Just a quick tip for those that love docker and find themselves wanting an app running quickly.
First, I recommend to everyone that wants to work with Docker to read their e-book. It gets auto updated with every release so this book will never get out of date. Yeah, they do continuous delivery with their books. Haha.
docker run --rm -p 8080:80 -v `pwd`:/usr/share/nginx/html:ro nginx:1.15-alpine |
--rmcleans up after the container exits-p 8080:80mounts host port 8080 to container port 80-v ...mounts the local directory to nginx’s default hosting path${PWD}can be used instead of`pwd`to print-working-directory
-it(not used above) will give you an interactive terminal. (it technically doesn’t stand for that.)- Simply navigate in your browser to localhost:8080 to see your files.
Other examples:
Interactive Node12 container |
But Why?
I can think of at least two reasons. First, you might want to run a different version of a piece of software than what is installed locally. Second, you might not want to install the software locally for various reasons.