Created
April 27, 2016 17:27
-
-
Save fuxingloh/2224f568975a9e0760c9cafa909cb35e to your computer and use it in GitHub Desktop.
Docker Rebuild with stop, rm, rmi build and run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Use it like this ./docker-rebuild.sh name 80:80 | |
| #chmod +x rebuild.sh | |
| #./rebuild.sh | |
| NAME=$1 | |
| PORT=$2 | |
| # Clean and Remove all | |
| docker stop $NAME | |
| docker rm $NAME | |
| docker rmi $NAME | |
| # Build and Run | |
| docker build -t $NAME . | |
| docker run -d -p $2 --name $NAME $NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment