Handy runtime Docker Container Commands

Here are some super handy docker container commands

Handy runtime Docker Container Commands
Photo by Ian Taylor / Unsplash

Here are some super handy docker container commands, so you (I) don't have to remember them and search the web each time you forget :)

docker container start {container_name}
Starts a running container
docker container stop {container_name}
Stops a running container
docker stats
Gets a live view resources view of running containers
docker exec -it {container_name} /bin/bash
Logs into running container and runs a bash shell
docker exec {container_name} env
Get running container environment variables
docker logs {container_name} -f
Tail the logs of a running container
docker events --filter event=restart --since=60m
Search the docker logs for any restart events in the last 60 minutes
docker exec {container_name} /bin/sh -c /usr/bin/env
Get the environment variables of a running container
apt update && apt upgrade -y && apt install iputils-ping -y
Install Ping into a new freshly baked container on Ubuntu