美文网首页
Docker note 02: Docker Compose 详

Docker note 02: Docker Compose 详

作者: 且听风吟_aab8 | 来源:发表于2019-07-31 07:15 被阅读0次

    Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features.

    Compose works in all environments: production, staging, development, testing, as well as CI workflows. You can learn more about each case in Common Use Cases.

    Using Compose is basically a three-step process:

    1. Define your app’s environment with a Dockerfile so it can be reproduced anywhere.

    2. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

    3. Run docker-compose up and Compose starts and runs your entire app.

    A docker-compose.yml looks like this:

    version: '3'
    services:
      web:
        build: .
        ports:
        - "5000:5000"
        volumes:
        - .:/code
        - logvolume01:/var/log
        links:
        - redis
      redis:
        image: redis
    volumes:
      logvolume01: {}
    
    

    相关文章

      网友评论

          本文标题:Docker note 02: Docker Compose 详

          本文链接:https://www.haomeiwen.com/subject/oiparctx.html