Install Docker in Windows and deploy Spring boot Micro Service

Sudha Subramaniam
2 min readDec 8, 2021

--

Download docker (Docker Desktop Installer) which is specific to windows version https://hub.docker.com/editions/community/docker-ce-desktop-windows

Install the downloaded file, in my case I have unselected Use the WSL 2 based engine in Docker settings and used Hyper-V in windows

Docker Settings Screen

Hyper-V installation

Go to windows Apps and Features →Turn windows features on or off →Select Hyper-V and click Ok which take sometime for installation

Then check docker version using docker — version to verify docker installation and then start docker using command start docker

Next Create Spring Boot micro service then add Docker file as like below (if you are using java 8 then in the Docker file mention as From java:8). Docker file is a text document which contains commands to assemble an image

Docker File
Docker File placement in Spring boot Micro service

And then build your application normally using mvn command

mvn clean package

which will create jar in target folder

Next build a docker image for the Spring boot Service using below command docker image build -t imagename .

Docker image creation

Next we can check the created docker image using below command

docker images

Available Docker images

Next use the Docker run command to create container from above created image and starts the same (port is optional here if we specified in application.properties)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response