将bin文件复制到docker容器会导致错误

时间:2017-08-18 10:19:01

标签: php docker docker-compose

我正在尝试设置docker-compose系统,我希望在启动时将开发工具复制到/usr/local/bin/

这就是我的docker-compose.yml

version: '3'

services:
  web:
    build: docker/container/nginx
    ports:
      - 4000:80
    volumes: &m2volume
      - ./src:/var/www/html/
      - ./docker/data/bin/:/usr/local/bin/
      - ~/.composer:/var/www/.composer
    networks: &m2network
      - www
    links:
      - "php"
      - "mariadb:mysql"
  mariadb:
    image: mariadb
    ports:
      - 8001:3306
    networks: *m2network
    ports:
      - "3307:3306"
    environment:
      MYSQL_ROOT_PASSWORD: magento2
      MYSQL_DATABASE: db
      MYSQL_USER: magento2
      MYSQL_PASSWORD: magento2
    volumes:
      - ./docker/container/db/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/
      - ./docker/container/db/conf.d:/etc/mysql/conf.d
      - ./docker/data/mariadb:/var/lib/mysql

  php:
    build: docker/container/fpm
    volumes: *m2volume
    networks: *m2network

networks:
  www:

如果我在其中留下- ./docker/data/bin/:/usr/local/bin/,我会收到错误:

ERROR: for m2_php_1  Cannot start service php: oci runtime error: container_linux.go:262: starting container process caused "exec: \"docker-php-entrypoint\": executable file not found in $PATH"
Starting m2_mariadb_1 ... done

ERROR: for php  Cannot start service php: oci runtime error: container_linux.go:262: starting container process caused "exec: \"docker-php-entrypoint\": executable file not found in $PATH"

如果我取消注释,一切正常。

我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

如果我理解正确,并且映射卷./docker/data/bin/:/usr/local/bin/导致异常,则可能是因为mariadb映像中定义的entrypoint

更重要的是,您正在覆盖/usr/local/bin容器文件夹,该文件夹可能包含入口点中使用的可执行文件。当它消失时,你会收到一个错误。