Where can I keep a database?

How do I keep a database container running?

  • I have a sybase ASE docker image working fine. I can run that image, start the database and use it...all good. I now want to create a start up script that I call as a command that starts up the db. in my script I have #!/bin/bash sysctl -w kernel.shmmax=1067108864 sysctl -w kernel.shmall=30000000000 startserver -f ${SYBASE}/${SYBASE_ASE}/install/RUN but when I run the script the container exits, as the script has finished. How do I keep the container running so I can expose the port to the db and use it? EDIT: I have the Sybase container working and can expose the port to the host and the host can connect fine. The only way I can keep the container running it to call my http://startSybase.sh while in the containers bash and then cntrl-p then cntrl-q to exit the container without stopping it. If I pass the same http://startSybase.sh script as a bash -c http://startSybase.sh it runs bit leaves the container in an exit 0 state under docker ps. I just need to be able to start the container from docker run without having to enter the container and running the script manually.

  • Answer:

    The container have those variables exposed, inside the container? You can try running docker run -i -t <your container name> /bin/bash to manual launch of sybase or that script to see if it runs, and if don't, check in logs/console what caused it. Also, can use several parameters of docker run to your advantage, like -d to the container in the background, -v to use "real" machine directories as container directories, like the ones where you will persist information, and --volumes-from, to keep using the disk volumes of a previous container, to get even more persistence

Gustavo Muslera at Quora Visit the source

Was this solution helpful to you?

Other answers

It sounds like `startserver -f ${SYBASE}/${SYBASE_ASE}/install/RUN is forking the sybase server off into another process. This process isn't PID 1, and when PID 1 (your startup script) exits, so does the docker container. Check to see if there is a way to make sybase not daemonize, but stay in the foreground. Then, use is forking the sybase server off into another process. This process isn't PID 1, and when PID 1 (your startup script) exits, so does the docker container. Check to see if there is a way to make sybase not daemonize, but stay in the foreground. Then, use exec to start it. For example, if '--foreground' to the startserver command causes it to run in the foreground, you might do: to start it. For example, if '--foreground' to the startserver command causes it to run in the foreground, you might do: exec startserver --foreground  -f ${SYBASE}/${SYBASE_ASE}/install/RUN`

Graham Scott Christensen

afaict, The best way of solving this is via "supervisord" ..  Please refer below url for more details on supervisord. https://docs.docker.com/articles/using_supervisord/

Humble Chirammal

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.