Note that, there is different way to do the same thing, ex: docker images = docker image ls
Command |
Description |
docker image ls |
list of all the images |
docker image ls -a |
show all images |
docker image ls -q |
show images id |
docker image rm ID_OF_IMAGE |
delete an images |
docker image rm $(docker image ls -a -q) |
delete all the images |
Command |
Description |
docker container ls |
list of all the containers running |
docker container ls -a |
show all the containers |
docker container ls -q |
show containers id |
docker container inspect ID_OF_CONTAINER |
inspect containers id |
docker container rm ID_OF_CONTAINER |
delete a container |
docker container rm $(docker container ls -a -q) |
delete all the containers |
Command |
Description |
docker container exec -it NAME_OF_CONTAINER bash |
open bash in the container |
docker container port NAME_OF_CONTAINER |
display port exported by the container |
docker container top NAME_OF_CONTAINER |
display jobs running inside the container |
Command |
Description |
docker network ls |
show networks |
docker network inspect |
inspect a network |
docker network create --driver |
create a network |
docker network connect |
Attack a network to a container |
docker network disconnect |
Detach a netwrok from a container |
there is two concept:
- data-volume, which is the data that container save on the machine
- bind mounting, data on the machine and read from the container
The bind mounting can be done through the command line, ex:
docker run -p 80:8000 -v /public:/path/to/public
or from the docker-compose file
The following command are related to data volumes
Volume |
Description |
docker volume ls |
list of volumes |
Command |
Description |
docker system df |
current state of your system |
docker system prune |
clean this that you don't run |
docker system prune -a |
+ remove all the images |
docker image prune |
clean unused image run |
docker container prune |
clean unused container run |