spring cloud eureka-server code I will not say.
1. Package for eureka-server-1.jar.
2. Create a new centos7 virtual machine. No, you can look at this one .
3. Modify Ip addr
4. Installation docker
Because within centos7 source of extras have been built docker, so installation is particularly simple, direct
yum install docker
Get!
5. Modify the image source docker docker :( because the original source download is too slow, the country much faster)
vi /etc/docker/daemon.json { "registry-mirrors": ["http://hub-mirror.c.163.com"] }
Then install the same as above editorial changes.
6. The jar package into
CD / usr / local mkdir Java then introduced jar package, how specifically introduced not Skip
7. Create image file in / usr / local / java directory (not annotated to indicate I do not quite understand)
Dockerfile Touch vi Dockerfile # source basis, without this local mirror, from the warehouse to the FROM the Java: # mount point VOLUME / tmp the ADD Eureka-Server-1.jar server.jar # port EXPOSE 8080 RUN bash -c "Touch / Server .jar " EntryPoint [" Java "," - Djava.security.egd = File: / dev /./ urandom "," - JAR "," / sever.jar "]
8. Also in / usr / local / java directory, create mirror.
If you do not follow behind #server tag, it defaults to the latest Note: There is a back. Docker Build -t Server.
# view mirror, you can see the generated image of the
docker images
9. Start container
# Port my project configuration is 8761 Docker RUN -d -p 8761: 8761 --name Server Server: lastest
Here -d representatives running in the background, -p represents the port mapping, - name representatives to take the name of the vessel, the follow-up can be used to start and stop
docker run -d -p 8761 (Local Port): 8761 (container port) --name server (new container name) server: lastest (image name)
10. The local test whether you can access the
# Can first view the log docker logs server
Well, this is over.