Saravanan's Corner: Blackberry Dev

Friday, 18 July 2025

Docker Commands

 Docker commands are used to manage Docker containers and images. Some of the most common commands include docker rundocker psdocker stopdocker startdocker rmdocker imagesdocker pull, and docker push. 

Here's a breakdown of some essential Docker commands:
Container Management:
  • docker run [OPTIONS] IMAGE [COMMAND] [ARG...]Creates and starts a new container from an image. 
  • docker psLists running containers. 
    • docker ps -a: Lists all containers (running and stopped). 
  • docker stop [CONTAINER...]Stops one or more running containers. 
  • docker start [CONTAINER...]Starts one or more stopped containers. 
  • docker restart [CONTAINER...]Restarts one or more running containers. 
  • docker kill [CONTAINER...]Kills one or more running containers (sends SIGKILL). 
  • docker rm [CONTAINER...]Removes one or more stopped containers. 
  • docker exec -it [CONTAINER] [COMMAND]Executes a command in a running container. 
  • docker logs [OPTIONS] CONTAINERFetches the logs of a container. 
  • docker inspect [CONTAINER...]Displays detailed information about one or more containers. 
  • docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-Copies files/folders between a container and the local filesystem. 
Image Management:
  • docker imagesLists all images on the host.
  • docker pull IMAGE[:TAG]Downloads an image from a registry.
  • docker push IMAGE[:TAG]Uploads an image to a registry.
  • docker rmi IMAGE [IMAGE...]Removes one or more images.
  • docker build [OPTIONS] PATHBuilds an image from a Dockerfile. 
Other Useful Commands:
  • docker versionDisplays the Docker version information.
  • docker infoDisplays system-wide information.
  • docker search TERMSearches Docker Hub for images.
  • docker network lsLists all networks.
  • docker volume lsLists all volumes.
  • docker system pruneRemoves stopped containers, dangling images, and unused networks and volumes.
  • docker compose upBuilds, creates, starts, and attaches to containers for a project.
  • docker compose downStops and removes containers, networks, and volumes. 

Kubernetes Commands

 

123

Kubernetes provides the kubectl command-line tool to interact with clusters. Below are some commonly used commands with examples to help you manage resources effectively.

1. List Resources

To view resources like pods, services, or nodes:

kubectl get pods
kubectl get services
kubectl get nodes

Use -o wide for detailed output:

kubectl get pods -o wide

2. Create Resources

Create resources using YAML files or directly via commands:

kubectl create -f deployment.yaml
kubectl run nginx --image=nginx --port=80

3. Apply Changes

Apply or update configurations from a file:

kubectl apply -f config.yaml

4. Delete Resources

Delete specific resources or all of a type:

kubectl delete pod my-pod
kubectl delete pods --all

5. View Resource Details

Get detailed information about a resource:

kubectl describe pod my-pod

6. Logs and Debugging

View logs of a pod or container:

kubectl logs my-pod
kubectl logs -f my-pod # Stream logs

Execute commands inside a container:

kubectl exec -it my-pod -- /bin/bash

7. Scaling and Rollouts

Scale deployments or manage rollouts:

kubectl scale deployment my-deployment --replicas=3
kubectl rollout status deployment/my-deployment

8. Copy Files

Copy files between host and container:

kubectl cp /local/path pod-name:/container/path

These commands are essential for managing Kubernetes clusters efficiently12.

Sunday, 13 July 2025

Java 21 Features

 Finalized Features:

  • Virtual Threads (Project Loom):
    Lightweight threads that simplify writing high-throughput, scalable applications by reducing the overhead of creating and managing threads. 
  • Record Patterns:
    Enable pattern matching for record deconstruction, making it easier to extract data from records. 
  • Pattern Matching for Switch:
    Enhances the switch statement, allowing for more complex pattern matching and reducing boilerplate code. 
  • Sequenced Collections:
    Introduces interfaces like SequencedCollectionSequencedSet, and SequencedMap to provide a consistent way to work with ordered collections and access their first and last elements. 
  • Foreign Function & Memory API (Final):
    Provides a stable API for interacting with native code, offering a more efficient and manageable way to integrate with non-Java code. 
  • Generational ZGC:
    Improves garbage collection performance by managing young and old object generations separately within the Z Garbage Co

Saturday, 12 July 2025

Latest version numbers

 Latest version of 

Spring Boot is 3.5.3

Spring Cloud2025.0.0

Stable Spring Framework is 6.2.8

Spring Data JPA3.5.1 

  • Hibernate ORM: 6.6 series is the latest stable, with 6.6.7.Final being a recent release within that series. 
  • Hibernate Validator: 8.0 is the latest stable. 
  • Hibernate Search: 6.0 series is the latest stable.
Apache Kafka is 4.0,
  • ZooKeeper Deprecation: ZooKeeper is deprecated and will be removed in a future version (planned for Apache Kafka 4.0). 
  •  removing ZooKeeper dependency and using KRaft by default for cluster management. 

Java 11 features

 Language Enhancements:

  • var in Lambda Expressions: Java 11 allows the use of var keyword for local variable type inference in lambda expressions, improving readability and consistency. 
Java
    list.forEach((var item) -> System.out.println(item)); // Example
2. New APIs:
  • String::isBlank()Checks if a string is empty or contains only whitespace characters. 
Java
    String str = "   ";    System.out.println(str.isBlank()); // true
  • String::strip()Removes leading and trailing whitespace, handling Unicode characters correctly. 
Java
    String str = "  hello  ";    System.out.println(str.strip()); // "hello"
  • String::lines()Returns a stream of lines from a string. 
  • Files::readString()Reads the entire content of a file into a string. 
  • HttpClientA new, asynchronous, and non-blocking HTTP client API supporting HTTP/1.1 and HTTP/2. 
  • Predicate::not()A static method that negates a predicate. 
Java
    Predicate<String> notEmpty = String::isEmpty;    Predicate<String> notEmptyNegated = Predicate.not(String::isEmpty);

  • New toArray method: A new toArray method in the Collection interface that takes an IntFunction argument for more convenient array creation.