Docker-from installation to deployment of a Web application (go, Java)

Source: Internet
Author: User
Tags docker cp docker run
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.