I am trying to start my own container and link it with the official mysql container. I am using docker-compose to start both containers and link them together. My own container is supposed to be a regular LAMP-stack which runs a simple PHP application.
When I run docker-compose up
, they both build properly, but when docker tries to run them, they just stop with the error code mytestservice_web_1 exited with code 0
. I can not see any errors in the build log.
Here is my docker-compose.yml
web:
build: .
links:
- mysql
ports:
- "80:80"
mysql:
image: mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=verysecret
Here is my Dockerfile for my own container.
FROM linode/lamp
WORKDIR /var/www
RUN a2enmod rewrite
ADD . /var/www/mytestservice
ADD mytestservice.conf /etc/apache2/sites-enabled/
CMD service apache2 start
If I start them manually with docker run there are no problems.
How can I keep the containers running?
As mentioned in my comment above:
CMD exec /usr/sbin/apachectl -D FOREGROUND
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With