Useful Docker Commands

Reading time ~1 minute

I use docker everyday at work. Here are a few commands that are useful :

  1. Few useful docker-compose and docker commands:
    • docker-compose build - builds all the service containers. To build a single service container, use docker-compose build [serv_cont_name]
    • docker-compose down - stops and removes the service containers
    • docker-compose up -d - brings up the service containers by picking the changes done in docker-compose.yml
    • docker ps - check running containers
    • docker ps -a - check running and stopped containers
    • docker stop $(docker ps -a -q) - stops all the containers
    • docker rm $(docker ps -a -q) - removes all the containers. Useful when you run into issue of already container is in use.
    • docker compose cli
    • docker compose reference
    • docker cli
  2. If you want to run the docker images separately i.e, one by one, run the command docker-compose run –no-deps [service_cont_name]. If the container is running and one wants to get inside, use cmd: docker-compose exec [service_cont_name] /bin/bash or docker exec -it [cont_name] /bin/bash

  3. Best way to check logs of containers is to use command: docker logs -f [cont_name]. If one wants to see all the docker-compose service container logs at once, then just run docker-compose logs -f

My First 10K run

> 10K doneI ran my first 5k in Nov 2015. I was quite elated at the experience that wrote a post in this blogThis year, I had set a goal f...… Continue reading

Walking around in Ranikhet and Majkhali

Published on July 04, 2021

Python GUI Development: Tkinter

Published on June 23, 2021