Skip to content

Instantly share code, notes, and snippets.

@takara
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takara/d5372442486897ffd215 to your computer and use it in GitHub Desktop.
Save takara/d5372442486897ffd215 to your computer and use it in GitHub Desktop.
$ make build
$ make start
$ make restart
$ make clean
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