Last active
August 29, 2015 14:24
-
-
Save takara/d5372442486897ffd215 to your computer and use it in GitHub Desktop.
DockerのMakefile ref: http://qiita.com/takara@github/items/a0a295d265ab5ff43ddc
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
$ make build |
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
$ make start |
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
$ make restart |
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
$ make clean |
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
NAME=xxx | |
VERSION=xxx | |
build: | |
docker build -t $(NAME):$(VERSION) . | |
restart: stop start | |
start: | |
docker run -itd \ | |
-p xxx:xxx \ | |
-v xxx:xxx \ | |
--name $(NAME) \ | |
$(NAME):$(VERSION) bash | |
contener=`docker ps -a -q` | |
image=`docker images | awk '/^<none>/ { print $$3 }'` | |
clean: | |
@if [ "$(image)" != "" ] ; then \ | |
docker rmi $(image); \ | |
fi | |
@if [ "$(contener)" != "" ] ; then \ | |
docker rm $(contener); \ | |
fi | |
stop: | |
docker rm -f $(NAME) | |
attach: | |
docker exec -it $(NAME) /bin/bash | |
logs: | |
docker logs $(NAME) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment