Docker – Commands

By | 08/06/2022

In this post, we will see some Docker commands that they can help us in our Docker projects.


DOWNLOAD A DOCKER IMAGE

docker pull ‘name of image’

docker pull hello-world


LIST DOCKER IMAGES

docker images


REMOVE DOCKER IMAGE

docker rmi ‘image id’

docker rmi feb5d9fea6a5


REMOVE ALL DOCKER IMAGES

docker rmi $(docker images -q) --force


RUN DOCKER CONTAINER

docker run ‘name of image’

docker run hello-world


START AND STOP A DOCKER CONTAINER

docker start ‘container id’

docker start 15659640e373

docker stop ‘container id’

docker stop 15659640e373


STOP ALL DOCKER CONTAINERS

docker kill $(docker ps -q)


REMOVE A DOCKER CONTAINER

docker container rm ‘container id’

docker container rm b7f520543643


REMOVE ALL DOCKER CONTAINERS

docker rm $(docker ps -a -q)


LIST OF DOCKER VOLUMES

docker volume list


DELETE A DOCKER VOLUME

docker volume rm ‘name of volume’

docker volume rm 0a05a0e36fe650ede59d032dbc38842dff3c8c55b26af10f87b2a32125f1c32d


DELETE ALL DOCKER VOLUMES

docker volume prune


LIST OF DOCKER NETWORKS

docker network list


DELETE A DOCKER NETWORK

docker network rm ‘network id’

docker network rm 90e869ad21ac


DELETE ALL DOCKER NETWORKS

docker network prune



RUN A DOCKER COMPOSE FILE
Run a docker compose file called ‘docker-compose.yml’

docker compose up -d


Run a docker compose file called ‘docker-compose-sql-server.yml’

docker compose -f docker-compose-sql-server.yml up -d



Leave a Reply

Your email address will not be published. Required fields are marked *