0% found this document useful (0 votes)
84 views

Docker Commands

This document provides examples of Docker commands for pulling images, running single and multi-container applications, and removing all Docker containers and images. It shows commands for pulling an image from Docker Hub, building and running a single container application, running multi-container applications with Docker Compose, and stopping, removing, and pruning all containers and images.

Uploaded by

vlado10305
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Docker Commands

This document provides examples of Docker commands for pulling images, running single and multi-container applications, and removing all Docker containers and images. It shows commands for pulling an image from Docker Hub, building and running a single container application, running multi-container applications with Docker Compose, and stopping, removing, and pruning all containers and images.

Uploaded by

vlado10305
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Docker Commands

Example docker hub pull :


docker run -d --hostname swn-rabbit --name swn-rabbit -p 5672:5672 -p
15672:15672 rabbitmq:3-management

Single Container
For aspnetcore app after adding docker file -- for single container add docker file
build and run = create new container
$ docker build -t aspnetapp .
$ docker run -d -p 8080:80 --name myapp aspnetapp

docker compose up
This command run multiple container

Multi Container - docker-compose.yml


docker-compose up
docker-compose -f docker-compose.yaml -f docker-compose-infrastructure.yaml
up --build

docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build

DOCKER REMOVE ALL CONTAINER IMAGES PS -A

POWERSHELL commands

https://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images

List all containers (only IDs)


docker ps -aq

Stop all running containers


docker stop $(docker ps -aq)

Remove all containers


docker rm $(docker ps -aq)

Remove all images


docker rmi $(docker images -q)

Remove all none images


docker system prune

-- You can also run all with copy paste

docker ps -aq
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q) -f
docker system prune

You might also like