-compose.yml fileUpstream App {{{Range service ' Logapi '}}server {.} address}}:{{. Port}} max_fails=3 fail_timeout=60 weight=1;{{Else}}server 127.0.0.1:65535; # force a 502{{end}}}server {Listen default_server;Location/{Proxy_pass Http://app;Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;Proxy_set_header Host $host;Proxy_set_header X-real-ip $remote _addr;}}Go to the directory where the Docker-compose.yml file is locatedRunning sudo
build a Docker-compose.yaml file.
services: Used to indicate the service that compose needs to start, we can see that there are three services in this file: Nginx, MySQL, app.
container_name: Container Name
environment: The information under this node is passed into the container as an environment variable, and in this example the MySQL service configures
Overall environment configurationThe configuration of the overall environment, if one Dockerfile to write, then it is quite troublesome, fortunately, Docker has a tool called docker-compose, we can use it to complete the configuration of the overall environment:First, let's look at the contents of the DOCKER-COMPOSE.YM
0x0. Origin:On a new Fedora 25 today, following official documentation, after installing docker-compose using curl, verify that an error occurred when the installation was successful:The command used for installation is;Curl-l https://github.com/docker/compose/releases/download/1.14.0-rc2/
template file (YAML format) can define an application that contains multiple interrelated containers. The Compose project was written in Python, based on the Docker API we will learn in the following experiment.Two. Docker Compose configuration testConfiguring the Environment redhat7.21. Put
In the previous part, " Run the ASPDOTNETCOREMVC program on Docker-part4: Load Balancing ", We have several more complex steps on the Docker platform to achieve the load balance of the website program, configuration steps are more. If the actual site is less, the overall architecture is relatively simple case, this does not have much problem, if the application of more time, will be prone to error. At this
app:restart:always Build:./app working_dir:/app volumes:-. /app:/app-~/.m2:/root/.m2 Expose:-"8080" depends_on:-nginx-mysql command:mvn clean s Pring-boot:run-dspring-boot.run.profiles=docker
version: ‘3‘: Represents the use of a third-generation syntax to build a Docker-compose.yaml file.
services: Used to indicate the service that
the container Log Service Driver # specify the logging driver. The default value is JSON-file (equivalent to docker run -- log-driver) options # specify the relevant log parameters (equivalent to docker run -- log-oPt) max-size # Set the size of a single log file, when this value is reached, log scrolling is performed. Max-file # Number of log files retained. netwo Rk_mode # specify the network mode (equiv
For details about how to install docker-ce and docker-compose in ubuntu,Install docker in mint 18.2 (Sonya)
Similar to ubuntu installation, refer to the ubuntu installation method provided on the official website.Delete the original version
Sudo apt-get remove docker-engine
Docker ~ Docker-compose and dockercompose
Back to directory
Docker-compose is a tool used to define and run complex applications in Docker. For example, to define multiple containers in a yum file, you can use only one line of com
complete, we can run the docker images view resultsWrite appThe first step is to create a simple app.rb fileThe second part, enter the following coderequire‘sinatra‘set‘0.0.0.0‘get‘/‘do ‘Hello world!‘endOne notable point here is that you need to set the server to bind to the 0.0.0.0 address, otherwise the container will not be accessible outside.New start.sh FileThis file is primarily used to start the Web application#!/bin/bashruby -rubygems app.rb
http://hongge.blog.51cto.com/ Docker Compose Project Compose Project Introduction The compose project originates from the previous Fig project and is written in Python code. The Compose project is primarily used to orchestrate the deployment of
:# Service Group name nginx-1: image:nginx # Mirroring networks: network-cn: # Custom Network Name aliases: nbsNetwork aliases for p;-nginx#overlay Networks hostname:nginx # hostname inside the container container_name:nginx-1 # container name when creating a container ports: # Map Ports - "80:80" - "443:443" environment: #--env Configuration -constraint:node== swarm-node-28 volumes: # Mount Di
Use docker-compose to build the AspNetCore development environment,
Use docker-compose to build the AspNetCore Development Environment
1. Use docker-compose to build a Development Environment
Our goal is simple: Use
This article mainly introduces the use of Docker compose Orchestration Laravel application, has a certain reference value, now share to everyone, the need for friends can refer to
Objective
Laravel Official development environment recommended is homestead (in fact, is a well-packaged vagrant box), I feel this is more heavy, so I used Docker
Docker-compose Use Example
Using Docker to build a MySQL + Java service + Nginx, a total of 4 Docker containers, if used Docker run way a container to create very cumbersome. In order to create containers more efficiently,
Compose is a tool for defining and running Multi-container Docker applications. With Compose, you use a Compose file to configure your application ' s services. Then, using a single command, you create and start all the Servicesfrom your configuration. To learn more on all the features of Composesee the list of feature
Brief introduction:Docker can run a configured server on a single command, which is handy.But there is also a problem is that when the parameters are more, the mapping directory is more, map port more ...I used to write a script, start with a foot, very low ah.Also see some of the Docker Image introduction page has introduced Docker-compose, but because has been
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.