Roger Almeida

A blog about tech

Git cheat sheet

🐳 Docker Cheatsheet

πŸ§’πŸΎ How to check how much memory the containers are consuming?

docker stats

docs: https://docs.docker.com/engine/reference/commandline/stats/

πŸ§‘πŸΎβ€πŸ¦³ Jump into a shell prompt inside a running docker?

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG…]

docker exec -it my-container:local /bin/sh

ℹ️ For alpine use /bin/bash while for debian /bin/bash

πŸ‘±πŸΎ Jump into a shell prompt inside a container which is part of docker-compose

docker-compose run --rm worker /bin/bash

πŸ§‘πŸΎβ€πŸ¦° Remove docker compose images using Make

In your Makefile:

DOCKER_IMAGES=$(shell docker images | grep <NAME OF YOUR APP|DIR >| sed -E 's/[[:space:]]+/,/g' | cut -d',' -f3)

remove_docker_images: stop_all
	docker image rm --force $(DOCKER_IMAGES)
.NOPHONY: remove_docker_images

04 Sep 2023