This is a creation in Article, where the information may have evolved or changed.
Description
1. Permission is root, not the first to elevate permissions
One: Installing Docker
1.https://docs.docker.com/engine/installation/binaries/
Download Docker latest Version binary tar.gz
linux下:wget https://get.docker.com/builds/Darwin/x86_64/docker-1.11.0.tgz
2. Drop into the $path
mv docker /usr/local/sbin
3. Start
docker daemon &
Two. Run Tomcat on the container
The official Docker image warehouse is slow to download because of the wall. At the moment I am using the image of the speed cloud.
First step: Pull the mirror to the local
docker pull index.tenxcloud.com/tenxcloud/tomcat
Step two: Add an alias to the image
docker tag index.tenxcloud.com/tenxcloud/tomcat tomcat-1
Step two: Start tomcat
docker run -p 5000:8080 --name container1 tomcat-1
As a result, Tomcat starts, and the-p 5,000:8,080 means to insinuate the 8080 port of the container tomcat to the port of the host, so that the extranet access 5000 will be able to access our container1 8080 tomcat.
As a result, a simple tomcat is running.
Here the container container1 and mirror tomcat-1, my understanding is that the mirror is a template, Container1 is based on this template to create a real basin, the basin is running our tomcat. So we can create many container with the same image.
Three. Deploy our app on Tomcat
Next we want to deploy our application, the idea is to enter into the container1 inside, at this time can think of Container1 as a new machine, we just need to go to Tomcat WebApp throw the war, and then restart on the line.
1. Enter inside the container
docker exec -it container2 /bin/bash
2. View the Tomcat WebApp path
/tomcat/webapps
3. Pass the War
Throw the war to the host, throw it into the container and throw it to the Tomcat/webapps.
docker cp DemoOne.war container2:tomcat/webapps
Too TM Surprise, Docker itself support Ah!!! 666666.
4. Restart the container
No need for ... Docker automatically helps you deploy the
5. Accessing the App
At this point, a complete Docker deployment Tomcat and on-line Java Web application process has gone through.
To tell the truth, it was so easy to find out after walking. The previous concept does not understand where the above is also basic.
Have to say very nice, and the same as expected, the dokcer to you to create the container as a new Linux use it!
Then fill in the Golang image and application deployment process