docker-compose is super helpful to start docker stuff. Create a docker file, I've been having the best luck with version 3.1, and run docker-compose up
. It's super nice.
docker-compose up -d
runs docker-compose in detatched mode.
--rm
flag used when starting up a container which will automatically remove the container when it stops. Usefu for one-offs.
docker ps -a OR docker container ls -a
docker network ls
docker volume ls
docker container ls --filter status=exited
List all exited containers. status can be any first word from the container ls -a command in the Status column.
Connect to a container that's already running
docker exec -it [containername] bash
docker container stop $(docker container ls -aq)
docker system prune
removes all stopped containers, all dangling images, and all unused networks.
docker system prune --volumes
ALSO prunes volumes
prune works on individual items too.
docker container prune docker network prune docker volume prune