[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Running commands



You're right, I want to start a mysql server but changing the mysql_datadir (the datadir doesn't exist, so I need to create it ussing variables). 


I think the necessary commands would be:

"mkdir", "${MYSQL_DATADIR}",
"mysqld-master", "--datadir=${MYSQL_DATADIR}"

Looking at documentation, there are only examples with one command:

"command":[
    "/usr/bin/command", "arg1", "arg2"
],

Is it possible to indicate various commands in the template?


El lun., 21 dic. 2015 a las 10:05, Rodolfo Carvalho (<rcarvalh redhat com>) escribió:
Hi Alejandro,


On Mon, Dec 21, 2015 at 9:33 AM, Alejandro Nieto Boza <ale90nb gmail com> wrote:
Hi, I'm launching a pod using the image "docker.io/openshift/mysql-55-centos7"


I want to run the container changing the mysql_datadir.

I've used the following template:


"spec": {
  "containers": [
    {
    "name": "${SERVICE}",
    "command":[
      "mysql_install_db --datadir=${MYSQL_DATADIR}"
    ],                          ],
...

Then, the container cannot run:

NAME                  READY     STATUS               RESTARTS   AGE
mysql-mount-1-4bsa5   0/1       ContainerCannotRun   0          53s



The error appear in logs:
exec: "mysql_install_db --datadir=${MYSQL_DATADIR}": executable file not found in $PATH

.....



The image has MySQL installed using Software Collections [1]. Before you use any command like mysql, mysql_install_db, etc, you need to enable the appropriate collection.
As a convenience, whenever you use sh or bash the collections are enabled for you [2].
 

$ docker run openshift/mysql-55-centos7 -- bash -c mysql_install_db --datadir=${MYSQL_DATADIR}


I tested it locally, and even without "bash -c" the command "mysql_install_db" is found (I think the image entrypoint script enables the mysql collection, and setting the PATH correctly).
So possibly you have an old version of the image.



Now keep in mind that mysql_install_db will start and end and will not start a mysql server, so I suspect that's not what you want your Pod template to be.




Regards,

--
Rodolfo Carvalho

OpenShift Developer Experience

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]