How do i check logs of a docker container ?

To demonstrate this, i have a sample spring boot application which prints log every 1000 milliseconds (1 second) @RestController public class RandomLoggerResource { private static final Logger logger = LoggerFactory.getLogger(RandomLoggerResource.class); private Random random = new Random(); @Scheduled(fixedRate = 1000) public void logRandomMessage() { int randomInt = random.nextInt(); String randomMessage = "Generating a Random integer every … Continue reading How do i check logs of a docker container ?

How do you add custom response headers in a Spring Boot application?

To add custom response headers in a Spring boot application use ResponeEntity class. Set the values using HttpHeader object. Set the header object in response entity To set a response header for all the response , implement a Filter class and set the header in the ServletResponse class Code Snippet @Component public class ResFilter implements … Continue reading How do you add custom response headers in a Spring Boot application?

How do you find period or times of the day in Java ?

I accidentally stumbled upon this feature in Java and although it might not be super useful, I have encountered a few use cases to identify the time or period of the day, such as morning, afternoon, or night and this feature has helped . Starting Java 16 , the DateTimeFormatter class which is used for … Continue reading How do you find period or times of the day in Java ?

My favorite reads of 2022

This year, my reading habit wasn't as regular and consistent as I wanted it to be, but I still managed to read quite a few books. These were my favorites Phoenix Project The Phoenix Project is a business novel written by Gene Kim, Kevin Behr, and George Spafford. It is a fictional story that follows … Continue reading My favorite reads of 2022

What are the alternatives for Kubernetes ?

The alternatives can be categorized into these 4 categories Container as a Service (CaaS): Options in this category are services like AWS Fargate and Azure Container Instances. These cloud services manage the complexity of managing containers at scale and eliminates the need for managing or running Kubernetes. Managed Kubernetes services : Popular choices in this … Continue reading What are the alternatives for Kubernetes ?

What is HELM, why do you need it & what problem does it solve for Kubernetes?

Helm is a tool which helps to manage Kubernetes applications. Deploying applications to Kubernetes is not a simple task and some of the concepts and techniques for deploying and managing applications and services has a steep learning curve. To deploy a simple spring boot application with PostgreSQL backend, explained in blog we had to write … Continue reading What is HELM, why do you need it & what problem does it solve for Kubernetes?

What is .gitignore and how do i generate or write one?

gitignore file is used to specify files which should be untracked by Git. Each line of the file represents a filename, directory, or pattern. When git looks for changes in your working directory, it will automatically ignore any file that matches an entry in your .gitignore file. For example, when working for a java spring … Continue reading What is .gitignore and how do i generate or write one?

Embedding source code into powerpoint.

Embedding code snippets in power point for any presentation is a painful task , as there is no support to format the code or present it with proper indentations or the way code is shown in an editor One trick is to grab the screen shot and then paste it on powerpoint but the end … Continue reading Embedding source code into powerpoint.

Can i copy files from host to container and from container to host ? If so, how can i do it ?

Yes, you can copy files from host to container and from container to host. The docker cp utility copies the contents of source to the destination. You can copy from the container’s file system to the local machine or the reverse, from the local filesystem to the container. Localhost --> Container docker cp <path of … Continue reading Can i copy files from host to container and from container to host ? If so, how can i do it ?

What are secrets in Kubernetes & how do you use it ?

A Secret object in kubernetes contains sensitive data such as client secret, password, token or a key. Secrets provide a way to store these sensitive informations separately from Pod definitions or container images. Since these secret objects can be created independently from Pod, there is a less risk of these information being exposed during the … Continue reading What are secrets in Kubernetes & how do you use it ?