Docker - SirajChaudhary/comprehensive-example-on-microservices-using-spring-boot-with-spring-cloud GitHub Wiki

How to create a Dockerfile

FROM java:8

EXPOSE 8081

ADD target/airport-pilot-service-0.0.1-SNAPSHOT.jar airport-pilot-service-0.0.1-SNAPSHOT.jar

ENTRYPOINT ["java", "-jar", "airport-pilot-service-0.0.1-SNAPSHOT.jar"]

How to create and push docker images

Stepl: Login to hub.docker.com
docker login

Step2: Build the image
docker build -t airport-pilot-service .

Step3: Verfiy
docker images

Step4: Tag the docker image
docker tag airport-pilot-service sirajchaudhary/airport:airport-pilot-service

Step5: Push the image to hub.docker.com
docker push sirajchaudhary/airport:airport-pilot-service

Similarly build and push all docker images for other microservices.|

How to create and push docker images without creating Dockerfile

Stepl: Install Docker Desktop
https: //docs. docker. com/desktop/windows/install

Step2: Build the docker image of your spring boot project ./mvnw spring-boot :build—image

Step3: Login to hub.docker.com docker login

Step4: Check docker image docker images

Step5: You can tag and push a new image to the repository

docker tag xxxxxxxx sirajchaudhary/airport:airport-pilot-service
docker push sirajchaudhary/airport:airport-pilot-service

where,
	xxxxxxxx is docker image id
	sirajchaudhary is docker account username
	airport is docker repository
	airport-pilot-service is tag

Note: Similarly we can push multiple docker images to single repository by tagging with different names

Docker Desktop Console

Docker Hub

⚠️ **GitHub.com Fallback** ⚠️