Skip to content

Docker Commands

Imran Sayed edited this page Oct 4, 2020 · 1 revision
docker ps // See all the running containers
docker ps --all // List all containers #depricated
docker container ls -a // List down all containers 
docker rm your-container-id // Remove the container
docker container restart your-container-id

// Stoping containers
docker-compose down // Stops and removes all the docker containers

// Restart conatiner
docker-compose up -d // Will check for any update in the docker.yml file and update only the container which are changed.

docker rm -f $your-container-id // Forcefully removes the running container with that container id.

// Get list of all images
docker ls
// Selected all images id
Ctr + Option and selected all image ids
// Delete docker images
docker rmi 8f1781b41c89
docker rmi 420b971d0f8b

Login to shell

// Get your container id first using the command 
docker container ls

// Then run the command with that container id
docker exec -it <container-name-or-ID> bash 

// e.g.
docker exec -it backend_wordpress_1 bash