鍍金池/ 問答/PHP  Linux/ 為什么我部署composer 容器,容器停止?

為什么我部署composer 容器,容器停止?

docker-composer 編排模版

dsfsd:
  restart: always
  environment:
    - "PHPIZE_DEPS=autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpcre-dev \t\tpkgconf \t\tre2c"
    - PHP_INI_DIR=/usr/local/etc/php
    - PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2
    - PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2
    - 'PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie'
    - >-
      GPG_KEYS=A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
      528995BFEDFBA7191D46839EF9BA0ADA31CBD89E
    - 'PHP_URL=https://secure.php.net/get/php-7.1.11.tar.xz/from/this/mirror'
    - >-
      PHP_ASC_URL=https://secure.php.net/get/php-7.1.11.tar.xz.asc/from/this/mirror
    - >-
      PHP_SHA256=074093e9d7d21afedc5106904218a80a47b854abe368d2728ed22184c884893e
    - COMPOSER_ALLOW_SUPERUSER=1
    - COMPOSER_HOME=/tmp
  memswap_limit: 0
  labels:
    aliyun.scale: '1'
  shm_size: 0
  image: 'composer:latest'
  memswap_reservation: 0
  volumes:
    - 'weip:/app:rw'
  kernel_memory: 0
  mem_limit: 0

下面是日志

dsfsd_dsfsd_1 | 2017-11-02T09:27:34.755076553Z   -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.755089194Z   -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.755120650Z 
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762265706Z Available commands:
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762323706Z   about           Shows the short information about Composer.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762351371Z   archive         Creates an archive of this composer package.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762364329Z   browse          Opens the package's repository URL or homepage in your browser.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762373204Z   clear-cache     Clears composer's internal package cache.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762381626Z   clearcache      Clears composer's internal package cache.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762389515Z   config          Sets config options.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762396916Z   create-project  Creates new project from a package into given directory.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762405811Z   depends         Shows which packages cause the given package to be installed.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762413708Z   diagnose        Diagnoses the system to identify common errors.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762422116Z   dump-autoload   Dumps the autoloader.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762429457Z   dumpautoload    Dumps the autoloader.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762438057Z   exec            Executes a vendored binary/script.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762445843Z   global          Allows running commands in the global composer dir ($COMPOSER_HOME).
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762454241Z   help            Displays help for a command
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762462275Z   home            Opens the package's repository URL or homepage in your browser.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762470114Z   info            Shows information about packages.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762478306Z   init            Creates a basic composer.json file in current directory.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762486684Z   install         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762494268Z   licenses        Shows information about licenses of dependencies.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762501815Z   list            Lists commands
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762509483Z   outdated        Shows a list of installed packages that have updates available, including their latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762518430Z   prohibits       Shows which packages prevent the given package from being installed.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762526122Z   remove          Removes a package from the require or require-dev.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762534057Z   require         Adds required packages to your composer.json and installs them.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762541440Z   run-script      Runs the scripts defined in composer.json.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762549580Z   search          Searches for packages.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762557420Z   self-update     Updates composer.phar to the latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762566543Z   selfupdate      Updates composer.phar to the latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762574780Z   show            Shows information about packages.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762613332Z   status          Shows a list of locally modified packages.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762626897Z   suggests        Shows package suggestions.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762636976Z   update          Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762646342Z   upgrade         Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762654788Z   validate        Validates a composer.json and composer.lock.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762662473Z   why             Shows which packages cause the given package to be installed.
dsfsd_dsfsd_1 | 2017-11-02T09:27:34.762669898Z   why-not         Shows which packages prevent the given package from being installed.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351264417Z    ______
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351397028Z   / ____/___  ____ ___  ____  ____  ________  _____
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351412520Z  / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351423661Z / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351432937Z \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351442236Z                     /_/
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351450723Z Composer version 1.5.2 2017-09-11 16:59:25
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351492728Z 
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351503941Z Usage:
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351511997Z   command [options] [arguments]
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351519572Z 
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351527974Z Options:
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351535328Z   -h, --help                     Display this help message
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351543161Z   -q, --quiet                    Do not output any message
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351551490Z   -V, --version                  Display this application version
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351560590Z       --ansi                     Force ANSI output
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351568888Z       --no-ansi                  Disable ANSI output
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351577333Z   -n, --no-interaction           Do not ask any interactive question
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351622957Z       --profile                  Display timing and memory usage information
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351633423Z       --no-plugins               Whether to disable plugins.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351642598Z   -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351654287Z   -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351663363Z 
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351672203Z Available commands:
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351680801Z   about           Shows the short information about Composer.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351689193Z   archive         Creates an archive of this composer package.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351752556Z   browse          Opens the package's repository URL or homepage in your browser.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351764864Z   clear-cache     Clears composer's internal package cache.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351773584Z   clearcache      Clears composer's internal package cache.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351780910Z   config          Sets config options.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.351788086Z   create-project  Creates new project from a package into given directory.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358215927Z   depends         Shows which packages cause the given package to be installed.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358273149Z   diagnose        Diagnoses the system to identify common errors.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358285457Z   dump-autoload   Dumps the autoloader.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358328061Z   dumpautoload    Dumps the autoloader.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358338786Z   exec            Executes a vendored binary/script.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358347689Z   global          Allows running commands in the global composer dir ($COMPOSER_HOME).
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358356681Z   help            Displays help for a command
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358365166Z   home            Opens the package's repository URL or homepage in your browser.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358373769Z   info            Shows information about packages.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358383016Z   init            Creates a basic composer.json file in current directory.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358391727Z   install         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358400674Z   licenses        Shows information about licenses of dependencies.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358409411Z   list            Lists commands
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358447296Z   outdated        Shows a list of installed packages that have updates available, including their latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358456174Z   prohibits       Shows which packages prevent the given package from being installed.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358461379Z   remove          Removes a package from the require or require-dev.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358466048Z   require         Adds required packages to your composer.json and installs them.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358470700Z   run-script      Runs the scripts defined in composer.json.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358477604Z   search          Searches for packages.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358482918Z   self-update     Updates composer.phar to the latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358487369Z   selfupdate      Updates composer.phar to the latest version.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358491969Z   show            Shows information about packages.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358496880Z   status          Shows a list of locally modified packages.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358504121Z   suggests        Shows package suggestions.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358508852Z   update          Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358572454Z   upgrade         Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358586214Z   validate        Validates a composer.json and composer.lock.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358594925Z   why             Shows which packages cause the given package to be installed.
dsfsd_dsfsd_1 | 2017-11-02T09:28:36.358604243Z   why-not         Shows which packages prevent the given package from being installed.
回答
編輯回答
瘋子范

看看composer hub說明就知道了,也和entrypoint和cmd有關(guān)系,cmd不是前面是命令后面是參數(shù)么,如果設(shè)置entrypoint那么cmd會默認得把數(shù)據(jù)作為參數(shù)提供,你可以嘗試覆蓋cmd,或者傳入?yún)?shù)。至于為什么容器掛掉,是因為composer在默認執(zhí)行了composer命令后,程序停止,那容器也會停止

2017年12月29日 18:15