I want to use docker-compose
to compose together php and several databases (orientdb, neo4j, etc). Then get into the php
container and use the shell to execute commands.
Individually, all of my container work swimmingly, and when I compose them together, they all run. However, I cannot for the life of me figure out how to keep the php
container alive so I can get into it for testing.
For simplicity, I'll just use a single database: orient-db.
My docker-compose.yml
file:
version: '2'
services:
php:
build: .
links:
- orientdb
orientdb:
image: orientdb:latest
environment:
ORIENTDB_ROOT_PASSWORD: rootpwd
ports:
- "2424:2424"
- "2480:2480"
My "php" Dockerfile
:
FROM php:5.6-cli
ADD . /spider
WORKDIR /spider
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
RUN composer install --prefer-source --no-interaction
RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
I have tried (among other things):
docker-compose up
in one terminal and thendocker attach
in another- enabling
tty
andstdin_open
in my compose file - using a
/bin/bash
command - variations of
CMD exec vendor/bin/phpunit -D FOREGROUND
And some references I've tried: - How to Keep Docker Container Running After Starting Services? - https://github.com/docker/compose/issues/1926 - https://github.com/docker/compose/issues/423
Any help would really be appreciated.
Thank you.