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

An Unplanned Trek and more

Winters ended, and the intense itch to travel and feeling to have a 1:1 with mountains had started again. This season we planned to do th...… Continue reading

2021 review and 2022 Goals

Published on January 02, 2022

2022 Book List

Published on January 02, 2022