Docker learning: configure the rancher network environment, download and start the Tomcat container

Source: Internet
Author: User
Tags docker ps

Docker learning: configure the rancher network environment, download and start the Tomcat container
1. About rancher

The rancher environment was set up last time, but the network was not configured properly (). Container not created successfully. This time, it turns out to be a network problem. The coreos installed in virtualbox is not configured with an ip address, causing network access failure. The agent is not successfully registered and has no host environment. You cannot create a Docker application.

2. Configure the network

If the network environment of virtualbox is not configured, the network is a nat environment. In this case, set the master site to 10.0.2.15.
This is the nat ip address allocated by virtualbox, but the network cannot communicate with external users.
You can only use port forwarding. If you want to place coreos in the Intranet environment, you need to use a bridge network:

Then configure the IP Address:

Vi/etc/systemd/network/static. network # edit the file: [Match] Name = eth0 # It is the Name of the NIC [Network] Address = 192.168.2.196Gateway = 192.168.2.1DNS = 192.168.2.1DNS = 114.114.114.114

Then restart the service:

systemctl restart systemd-networkd

At this time, the ip address is allocated. It can be accessed through the Intranet.

3. Set host

Add a Host:
First, enter the host IP address. If an error occurs, modify the IP address in the admin menu:

Then add an agent that can be monitored by rancher only after the agent service is available.
Of course, this host is itself.

A super-long id will be generated after the addition, and then you can view it using the docker logs id.

If no problem occurs during startup and docker ps is used, you can see the service.

You can see in host:

4. Create a tomcat container

Create a container:

Enter the tomcat image name, and then map port 9090 to tomcat 8080.
Because rancher already uses port 8080.

Start tomcat. Wait for tomcat to download and start.
After the startup is successful, you can monitor the container:

Tomcat can access:

The Host IP address is added with the mapped port 9090.

4. Summary

Rancher provides powerful functions to create docker in just a few clicks,
It greatly shortens the time and energy for building the environment.
The container running status can be directly monitored. You can create, copy, and migrate containers at any time.
At the same time, complicated docker configurations become super simple.

This article permanently updates the link address:

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.