Posts

Docker + Mongo DB + Volume Mount (Persistence)

Image
We observe that once the docker container is removed,  we lose the entire data along with that container and cant recover which was very precious for the business continuity. 😔  Here we will fix the issue by mounting the volume in the docker-compose file. Prerequisites: Basic awareness about Docker containers and how to make it up. Create docker-compose.yaml file as below  This configuration will pull the latest mongo image from the docker hub. Re-creating the data lose Scenario   Execute the docker file using the command docker-compose up -d  "-d" preferable to run in a detached mode run docker ps to check the container status  Will try to launch to mongo terminal by hitting the below command  docker exec -it c6d1608207ca bash (Used container id can use container name also) Once the terminal got opened execute   mongo admin -u root -p example will help to connect to the mong DB view the database using show dbs Now we can create a new database using the command use address

Docker Network & Docker-compose

Image
 

Docker & Spring Boot

Image
 My first upload to the containerized platform Goodbye to the server-based deployments. Feels good and well managed and can be distributed effortlessly. When I executed my first  http://localhost:9000/docker  new journey to the containerization started. Prerequisites I downloaded Docker and installed it in my local machine and created a free account in docker hub ( https://hub.docker.com/ ). Log in to the docker with the docker hub credentials (Right-click on the docker desktop and click sign in) Here goes my sample project set up  pom.xml Created a spring boot application using  https://start.spring.io/  with spring-boot-starter-web dependency. Created one controller to test the application Controller class The key part of the docker containerization is the creation of Docker file note*: Where 'D' should be capital and no extension is required. and the file content is  FROM java:8 -> from java8 image ADD target/springdocker.jar springdocker.jar -> our target jar naming