Basic Docker Commands at a Glance
We should know some basic Docker commands. Let’s have a look.
List of docker images:
List of running containers:
Stop a container:
docker stop [conatiner name/ID]
Delete docker image:
# delete docker rmi [image name/ID] # force delete docker rmi -f [image name/ID]
Stop and remove all of the Docker containers:
# stop all docker rm -vf $(docker ps -a -q) # delete all docker rmi -f $(docker images -a -q)
Run command in docker container from outside of the container:
# structure docker exec <container-name/ID> <your-command> # example (run command in Laravel container) docker exec b2fe1b8dac0f php artisan --version
Login to container:
docker exec -it <container-name/ID> bash
Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.