gurumelo
gurumelo

Reputation: 33

docker, mariadb doesn't start at "init", based in debian:stable

i am trying write a Dockerfile like that

FROM debian:stable
RUN apt-get update
RUN apt-get install -y mariadb-server
EXPOSE 3306
CMD ["mysqld"]

I create the image with

docker build -t debian1 .

And i create the container with

docker run -d --name my_container_debian -i -t debian1

20 seconds after, docker ps -a tells that container is exited. Why? I want the container is up and mariadb running. Thanks. Sorry for the question.

Upvotes: 2

Views: 244

Answers (1)

VonC
VonC

Reputation: 1323433

mysqld alone would exit too soon.

If you look at a MySQL server Dockerfile, you will note its ENTRYPOINT is a script docker-entrypoint.sh which will exec mysqld in foreground.

exec "$@"

Upvotes: 2

Related Questions