I’m started to work with docker and here I’ll be writing a list of useful commands which I usually use like a cheat sheet.
- List the containers
- docker ps
- docker ps a
- Display a live stream of container(s) resource usage statistics
- docker stats <ContainerId>
- Show the logs of a specific container id
- docker logs <ContainerId>
- docker logs -f <ContainerId>
- Enter in docker container via @FelipeCruz
- docker exec -it <ContainerName> /bin/bash
- Stop all containers via @FelipeCruz
- docker stop $(docker ps -aq)
- Remove all containers via @FelipeCruz
- docker rm $(docker ps -aq)
- Remove docker images filtered by name
- docker images | grep “analytics” | awk ‘{print $1 “:” $2}’ | xargs docker rmi
- Copy file from inside of a container outside
- docker cp <ContainerId>:/app/file.txt /home/youUser/
- journalctl -u docker.service
(I’ll updating this article with more details and new information)
Feel free to add any comment to this article sharing your useful commands related with docker 😉