In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to use Fig to allocate Docker, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Orchestration is a concept that is not strictly defined. It roughly describes the process of automating the configuration, collaboration, and management of services. In the Docker world, orchestration is used to describe a set of practices that manage applications running in multiple Docker containers, which may be running on multiple hosts.
Here the record uses Fig for simple container provisioning. Fig is an open source Python tool developed by the Orchard team and acquired by Docker in 2014.
Using Fig, you can use a YAML file to define a set of containers to start, as well as the properties of the container to run. Fig calls these containers services.
1. Install Fig on Linux
Sudo bash-c "curl-L https://github.com/docker/fig/release/download/0.5.2/linux > / usr/local/bin/figchmod + x / usr/local/bin/fig
Check to see if fig is installed successfully:
Fig-version
2. Sample application
The example that demonstrates Fig uses two containers:
Application container, running the Python sample program
Redis container, running the Redis database.
Build the application container:
Mkdir figappcd figapptouch Dockerfile
Download the author's edited app.py file and requirements.txt file (which holds the application's dependencies) to the figapp directory.
FROM python:2.7MAINTAINER James Turnbull ENV REFRESHED_AT 2014-08-01ADD. / figappWORKDIR / figappRUN pip install-r requirements.txt
This Dockerfile is based on the python:2.7 image. First add app.py and requirements.txt to the / figapp directory in the image. Then set the working directory to / figapp and execute the pip command to install the application's dependencies: flask and redis.
Build an image
Docker build-t "ivan/figapp".
3. Write fig.yml files
Using Fig, you can define a set of services (in the form of a Docker container) and start them. Fig can also specify the runtime properties of these services, which are similar to the parameters required by the docker run command. Define all the service-related properties in a YAML file, then execute the fig up command, and Fig starts these containers to execute with the specified parameters and merges all log output together.
Cd figapptouch fig.ymlweb: image: jamtur01/figapp command: python app.py ports:-"5000 volumes: -.: / figapp links:-redisredis: image: redis
The fig.yml file defines two services: web and redis. Image specifies the image to run, or you can use the build command and provide a Dockerfile for Fig to build an image:
Web: build: / home/james/figapp
Use command to specify the commands to be executed when the service starts. The port and volume to which the service is mapped is specified using ports and volumes. Use links to specify other services to which the service connects.
4. Run Fig
Execute the fig up command to run the service in the same directory as the fig.yml file. You can also add the-d parameter to make it run in the background.
5. Use Fig
The fig ps command lists all running services defined in the local fig.yml file.
The fig logs command looks at the log time of the service.
The fig stop command stops a running service.
Fig rm delete service.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.