Running docker-compose with mysql and native docker container

I am trying to run my own container and link it to the official mysql container. I use docker-compose to run both containers and bind them together. My own container should be a regular LAMP stack that launches a simple PHP application.

When I run docker-compose up , they both build correctly, but when docker tries to start them, they just stop with the error code mytestservice_web_1 exited with code 0 . I do not see 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 Docker file 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 run them manually when launching dockers, there is no problem.

How can I save containers?

+8
mysql docker
source share
1 answer

As mentioned in my comment above:

 CMD exec /usr/sbin/apachectl -D FOREGROUND 
+6
source share

All Articles