I created a docker container where I install mariadb-server and some more stuff (see screen), but now I want to keep the container running of course, so people can connect to the database server in the container.
The problem is that the container keeps exiting after completed running. In the last row of the screen you see i tried adding a tail -f, but that also didn't help.
These are the commands I use for building and running:
sudo docker build -t databaseserver .
sudo docker run -it -p 3306:3306 databaseserver
Please help me to just keep it running so i can connect to the running container
You should move much of startup.sh into the Dockerfile.
Then instead of calling service mysql start
which starts it in 'daemon mode', you should figure out how to start it interactively.
Then you would not have to tail the logs to keep the container from closing.
At that point you could invoke docker in daemon mode or interactively (your choice) and it should just work right.
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