Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot docker-compose up with composer container #44

Closed
nyonor opened this issue Feb 14, 2018 · 6 comments
Closed

Cannot docker-compose up with composer container #44

nyonor opened this issue Feb 14, 2018 · 6 comments

Comments

@nyonor
Copy link

nyonor commented Feb 14, 2018

Hi! This is My docker-compose.yml:

version:  '2'

volumes:
  database_data:
    driver: local

services:
  nginx:
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    volumes_from:
      - php

  php:
    build: ./docker/php/
    expose:
      - 9000
    volumes:
      - .:/var/www/html
    environment:
      XDEBUG_CONFIG: remote_host=192.168.1.40
      PHP_IDE_CONFIG: "serverName=nginx.local"

  mysql:
    image: mysql:latest
    command: --disable-partition-engine-check
    ports:
      - 3306:3306
    expose:
      - 3306
    environment:
      MYSQL_ROOT_PASSWORD: blablabla
      MYSQL_DATABASE: blablabla_db
      MYSQL_USER: blablabla
      MYSQL_PASSWORD: blablabla
    volumes:
        - database_data:/var/lib/mysql

  composer:
    build: ./docker/composer/
    volumes:
      - .:/app

This is the Dockerfile inside ./docker/composer/

FROM php:7-alpine

RUN apk --no-cache add curl git subversion openssh openssl mercurial tini bash zlib-dev

RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \
 && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"

RUN docker-php-ext-install zip

ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
ENV COMPOSER_VERSION 1.6.3

RUN curl -s -f -L -o /tmp/installer.php https://raw.githubusercontent.com/composer/getcomposer.org/b107d959a5924af895807021fcef4ffec5a76aa9/web/installer \
 && php -r " \
    \$signature = '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061'; \
    \$hash = hash('SHA384', file_get_contents('/tmp/installer.php')); \
    if (!hash_equals(\$signature, \$hash)) { \
        unlink('/tmp/installer.php'); \
        echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
        exit(1); \
    }" \
 && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
 && composer --ansi --version --no-interaction \
 && rm -rf /tmp/* /tmp/.htaccess

COPY docker-entrypoint.sh /docker-entrypoint.sh

WORKDIR /app

ENTRYPOINT ["/docker-entrypoint.sh"]

CMD ["composer"]

And i did create the docker-entrypoint.sh inside same directory.

Trying to docker-compose up...
The result is:

D:\Projects\php\manufactory>docker-compose up
Creating manufactory_php_1      ... done
Creating manufactory_composer_1 ...
Creating manufactory_nginx_1    ... done
Creating manufactory_mysql_1    ...
Creating manufactory_mysql_1    ... done
Attaching to manufactory_composer_1, manufactory_php_1, manufactory_nginx_1, manufactory_mysql_1
composer_1  | standard_init_linux.go:195: exec user process caused "exec format error"
php_1       | Failed loading /wherever/you/put/it/xdebug.so:  /wherever/you/put/it/xdebug.so: cannot open shared object file
: No such file or directory
php_1       | [14-Feb-2018 10:18:41] NOTICE: fpm is running, pid 1
php_1       | [14-Feb-2018 10:18:41] NOTICE: ready to handle connections
manufactory_composer_1 exited with code 1
mysql_1     | Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\main.py", line 975, in up
  File "compose\cli\log_printer.py", line 105, in run
  File "compose\cli\log_printer.py", line 109, in write
  File "codecs.py", line 370, in write
  File "site-packages\colorama\ansitowin32.py", line 40, in write
  File "site-packages\colorama\ansitowin32.py", line 141, in write
  File "site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
  File "site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
IOError: [Errno 0] Error
Failed to execute script docker-compose

Somebody can tell me why? Thx!

@alcohol
Copy link
Member

alcohol commented Feb 14, 2018

The composer image is for running commands only. It is not a container that runs a service or anything.

@nyonor
Copy link
Author

nyonor commented Feb 14, 2018

So if i want convinient deployment with docker-compose up then it is impossible?
For example - designer pulling the repo of project, than trying to deploy it on local machine to do some job he will be faced with obstacles...

@alcohol
Copy link
Member

alcohol commented Feb 14, 2018

No, I don't see why that should be the case. Are you new to docker-compose ?

@nyonor
Copy link
Author

nyonor commented Feb 14, 2018

Yes i am =)

@alcohol
Copy link
Member

alcohol commented Feb 14, 2018

docker-compose is more for managing your services. Installing dependencies is a build step. But, you can make a docker-compose step for this if you really want to.

  composer:
    image: composer:latest
    volumes:
      - .:/app
    command: 'true'

And then you could:

docker-compose run composer install

And when you run docker-compose up -d the composer service will just do nothing.

@nyonor
Copy link
Author

nyonor commented Feb 14, 2018

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants