Skip to content

Instantly share code, notes, and snippets.

@MrSaints
Last active May 16, 2017 11:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MrSaints/7660d8e7215ecab28c76 to your computer and use it in GitHub Desktop.
Save MrSaints/7660d8e7215ecab28c76 to your computer and use it in GitHub Desktop.
Notes on initiating a Docker Machine; killing Docker processes; cleaning Docker containers, and images; and building / running / executing with Docker. Docker, Docker, Docker...
# You probably don't need this one with the new Docker for MacOS #
docker-start() {
docker-machine start ${1:-dev}
eval "$(docker-machine env ${1:-dev})"
export DOCKER_IP=$(docker-machine ip ${1:-dev})
echo The machine ip is DOCKER_IP=$DOCKER_IP
}
# These clean up commands are no longer necessary with `docker system prune`
docker-kill() {
docker-compose kill
docker stop $(docker ps -a -q)
}
docker-clean() {
docker-compose rm -f
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
}
docker build --rm -f <Dockerfile> -t <Tag> .
docker exec -it <container> <command>
docker run --rm <image> <command>
docker-compose run --service-ports <service>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment