๐ Cheatsheet will rock you: Docker
Let's take a breath and just bookmark it. Today, lastly, I want to share with you a cheatsheet on Docker and what problems/solutions there may be.
General description
docker exec -it <container_name_or_id> <command> # execute command
-i # interactive mode (allows you to pass input)
-t # allocates a pseudo-terminal (tty) for communication.
<container_name_or_id> # container name or ID.
Basis
$ docker build
$ docker build --no-cache
$ docker compose build --no-cache
$ docker image ls all # all images
# Creates only a specific service
$ docker compose build <service>
$ docker container ls # all running containers
$ docker container ls -all # all containers
# privileged mode
$ docker run -d --privileged --name docker go:1.16
Compose
$ docker compose up
$ docker compose up -d # Starts containers in detached mode in the background
$ docker compose start # Starts already created containers (does not rebuild or recreate)
$ docker compose up --build # Creates images and then starts containers
$ docker compose up --force-recreate # Recreates containers even if nothing has changed
$ docker compose up --build --force-recreate # Completely rebuilds and recreates containers
$ docker compose stop
$ docker compose down # Stops and removes default containers, networks and volumes
$ docker compose down --volumes # Removes containers, networks and named/anonymous volumes
$ docker compose down --rmi all # Also removes all built images
$ docker compose rm # Removes stopped service containers (after stopping)
$ docker compose kill # Forcefully stops running containers
Lists and Profiles
$ docker compose ps # Lists running services and their status
$ docker compose logs # Display logs for all services
$ docker compose logs -f
$ docker compose exec <service> sh # Opens a shell inside a running container
$ docker compose config
In summary: tips and edited materials from the experience of colleagues, teachers and people around you can help you grow, that is, find your growth zones and move forward. Swing, it will help ๐
#toolchain #appsec #specialty #pmcases #paper #containersecurity
