I checked online that most boot project deployments are completed in Linux and docker hub environments. Since my development environment is under Windows, the docker container also uses docker tools, and it does not accelerate the docker hub. So I tried to use Alibaba Cloud docker repository to complete the deployment in the Windows environment.
1. Create a new folder in docker tools, find the location, and then put the packaged boot jar file into the newly created folder
Create a new Dockerfile file under this folder, the example is as follows:
FROM daocloud.io/java:8COPY letou-0.0.1-SNAPSHOT.jar app.jarEXPOSE 8080ENTRYPOINT ["java","-jar","-spring.profiles.active=prod"]
Create containers using the docker build command
docker build -t spring-boot-docker-cloudcomb:0.1.0.
2 Upload the container to Alibaba Cloud
Enter the Alibaba Cloud Mirror Service link, click Create My Container Mirror, and then click Create Mirror Repository. Select the local repository here
After creation, follow Alibaba Cloud's operating guide to operate in docker tools
Log in to Alibaba Cloud docker registry:$ sudo docker login --username=Username of Alibaba Cloud Image Repository Registry.cn-hangzhou.aliyuncs.com The user name of login to registry is your Alibaba Cloud account full name, and the password is the password you set when you enable namespace. You can click the button in the upper right corner of the mirror management home page to modify the docker login password. Push the image to the registry: $ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/namespace/repository name: [mirror version number]$ sudo docker push registry.cn-hangzhou.aliyuncs.com/namespace/repository name: [mirror version number] where [ImageId], [mirror version number] please fill in according to your own mirror information.
3. Pull the image from Alibaba Cloud to start docker
docker pull registry.cn-hangzhou.aliyuncs.com/namespace/repository name docker run --name container name -d mirror name: mirror version number
In this way, the local springboot project can be packaged into a docker container and released on Alibaba Cloud.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.