

If you do need to keep the ENTRYPOINT, then you need to make sure it runs the CMD when it's done with its initial setup. This is where, if you delete the ENTRYPOINT, then CMD alone will be the main container process. You already have that as your CMD, though, you're just not running it. The right answer here is to not use service but rather to just run the main container process in the foreground. One of the ways it can fail is that the service command launches the service in the background, so if your container's main process is just to run service mysql start, when that command completes the container exits too. service broadly doesn't work in Docker, though. In your case the init.sh just runs two service commands and exits. When the ENTRYPOINT process exits, the container exits too. That command is constructed by passing the CMD as arguments to the ENTRYPOINT.

I'm guessing this will work if you delete the ENTRYPOINT line and the init.sh script.Ī Docker container only runs one command. RUN service mysql start & mysql -u root -e "ALTER USER IDENTIFIED BY '$MYSQL_ROOT_PASSWORD' FLUSH PRIVILEGES " to troubleshoot the problem of access denied I read somewhere to try to reset the root password, so i tried doing so in a RUN instruction in the Dockerfile as.I manually docker run -rm -it -name testing_db debian and run all the instructions from dockerfile inside the container, everything worked fine and was able to start and stop the database server ?.

what i have tried to troubleshoot the problem: The third line shows that the MariaDB server is failing to stop, which I also have no idea why.

It seems that the database is started successfully while the second line suggests that I am trying to use the root user without a password, but I read that by default, the root password is blank, and I'm not setting it or using MySQL client anywhere, so I frankly have no idea where that is coming from. However, I'm getting a error of: db | Starting MariaDB database server: mysqld.ĭb | ERROR 1045 (28000): Access denied for user (using password: NO)ĭb | Stopping MariaDB database server: mysqld failed!ĭb | Starting MariaDB database server: mysqld. RUN sed -i 's/^bind-address\s*=.*/bind-address=0.0.0.0/' /etc/mysql//50-server.cnfįor now I just want to get it to work so my init.sh script is simply: service mysql start & service mysql stop RUN apt-get update -y & apt-get upgrade -y & apt-get install wget mariadb-server procps -y My Dockerfile is as follows: FROM debian:buster I am trying to create a Docker container for MariaDB server using Debian as the base image.
