Minimal commands

This write up is mainly for my reminder as it is easy to forget docker commands. And should be valuable for people with hacker mentality to start with docker.

Commands are:

  • docker build -t . # There dot is source to target Dockerfile destination
  • docker run -d --name <container name> <image name>
  • docker compose up
    • docker-compose up -d ( For Detach mode)
  • docker-compose down
  • docker-compose restart
  • docker-compose logs
  • docker logs --timestamps --follow --since=60m
  • docker rmi $(docker images -f "dangling=true" -q | tr "\n" " ") # remove dangling images.
  • docker container prune # remove all stopped container.
  • docker-compose up -d --build crawler # Build and restart a specific service
  • docker-compose up -d --force-recreate --no-deps --build service_name
  • docker update --restart unless-stopped $(docker ps -q)