Hamid Nafar's Blog

Build and run docker container

February 27, 2018

Build docker container, run it, stop it, rinse and repeat. Running with -it runs in interactive mode with pseudo-TTY, so CTRL-C can stop the contianer, --rm auto-removes.

docker build -t image-name . && docker run -it --rm -p 8080:80 -e ENVIRONMENT_VAR=Value image-name