0

I'm trying to perform few installations in the Mariadb image and then start the mysql service.

This is my Dockerfile

FROM mariadb
COPY . /usr/src/app
WORKDIR /usr/src/app
# I will be performing a phpmyadmin installation in this script
RUN setup.sh
CMD service mysql start && service apache2 start

The container waits for about 20 seconds for mysql service to start and it eventually exits.

This is the only log message I have

Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!

When I manually exec into the container within 20 seconds and perform a service mysql status, this is the output I have

[info] MariaDB is stopped..

Febin K G
  • 93
  • 1
  • 8
  • 2
    Possible duplicate of [How to keep Docker container running after starting services?](https://stackoverflow.com/questions/25775266/how-to-keep-docker-container-running-after-starting-services) – David Maze Jul 31 '18 at 11:05
  • You should assume that commands like `service` just don't work in Docker. Where you're trying to run two wildly different things (a database server and an application) you should run them in two separate containers, and not try to install your application on top of the database image. – David Maze Jul 31 '18 at 11:05
  • I'll give that a try. I had verified `service` works on this image. The issue here was with me overriding the default CMD of mariadb. – Febin K G Jul 31 '18 at 12:13
  • What operating system? – Rick James Aug 19 '18 at 02:44

0 Answers0