Last active
January 24, 2019 23:54
-
-
Save eslam-mahmoud/60b24edea3acd832ee8a3b8eec0dc754 to your computer and use it in GitHub Desktop.
sh script to stop current container and remove it and rebuild the image and run the container, can be used after pull new code
This file contains 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
#from https://stackoverflow.com/questions/41322541/rebuild-docker-container-on-file-changes | |
#!/bin/bash | |
imageName=app | |
containerName=app-container | |
docker build -t $imageName -f Dockerfile . | |
echo Delete old container... | |
docker rm -f $containerName | |
echo Run new container... | |
docker run -d -p 80:80 --name $containerName $imageName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment