Need help to convert a "docker run" command into a DMP confguration

58 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Vincent Massol

nieprzeczytany,
3 sty 2018, 10:37:193.01.2018
do fabric8
Hi guys,

I'm trying to convert the following docker run command into a DMP configuration:

docker run --net=xwiki-nw --name mysql-xwiki -v /my/own/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1

So far I have this:

      <plugin>
       
<groupId>io.fabric8</groupId>
       
<artifactId>docker-maven-plugin</artifactId>
       
<version>0.23.0</version>
       
<extensions>true</extensions>
       
<configuration>
         
<imagePullPolicy>IfNotPresent</imagePullPolicy>
         
<docker.autoCreateCustomNetworks>true</docker.autoCreateCustomNetworks>
         
<images>
           
<image>
             
<alias>mysql-xwiki</alias>
             
<name>mysql:5.7</name>
             
<run>
               
<network>
                 
<mode>custom</mode>
                 
<name>xwiki-nw</name>
               
</network>
               
<volumes>
                 
<bind>
                   
<volume>${project.build.directory}/docker/mysql:/var/lib/mysql</volume>
                 
</bind>
               
</volumes>
               
<env>
                 
<MYSQL_ROOT_PASSWORD>xwiki</MYSQL_ROOT_PASSWORD>
                 
<MYSQL_USER>xwiki</MYSQL_USER>
                 
<MYSQL_PASSWORD>xwiki</MYSQL_PASSWORD>
                 
<MYSQL_DATABASE>xwiki</MYSQL_DATABASE>
               
</env>
               
<cmd>--character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1</cmd>
             
</run>
           
</image>
         
</images>
       
</configuration>
     
</plugin>



Right now the first issue I get is that the docker network is not created. The documentation says that <docker.autoCreateCustomNetworks>true</docker.autoCreateCustomNetworks> should create it automatically. Any idea why this is not happening?

I also believe that the "cmd" might not be correct. I only want to specify the ARG from docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...] but I suspect that the <cmd> is for [COMMAND] [ARG...]

Any help is welcome.

Thanks
-Vincent

Vincent Massol

nieprzeczytany,
3 sty 2018, 11:31:043.01.2018
do fabric8
For the network I've found the problem. The property name is "autoCreateCustomNetworks" and not "docker.autoCreateCustomNetworks"...

Still need to figure out if the <cmd> config is the good one or not. Any idea?

Thanks
-Vincent

Roland Huss

nieprzeczytany,
3 sty 2018, 12:41:303.01.2018
do Vincent Massol, fabric8
Hi Vincent, 

right it's '<autoCreateCustomNetworks>' for the configuration and and ' docker.autoCreateCustomNetworks' when used as Maven property. We should be more clear here.

For the command, I'd try

<cmd>
   <arg>--character-set-server=utf8</arg>
   <arg>--collation-server=utf8_bin</arg>
   <arg>--explicit-defaults-for-timestamp=1</arg>
</cmd>

I suspect when you give it the way you described it will be interpreted as a single argument, not three.The array format should be always used when an ENTRYPOINT is given in the base image. I have to add this to the docs, too ...

 
regards ...
... roland




--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
... roland

Vincent Massol

nieprzeczytany,
4 sty 2018, 04:22:214.01.2018
do fabric8
Thanks Roland, I'll try this!
-Vincent
Wiadomość została usunięta

Vincent Massol

nieprzeczytany,
4 sty 2018, 05:14:194.01.2018
do fabric8
I confirm it's working! 

FTR I checked this by logging on the mysql container and executing:

mysql> SHOW VARIABLES LIKE  'char%';



+--------------------------+----------------------------+

| Variable_name            | Value                      |

+--------------------------+----------------------------+

| character_set_client     | latin1                     |

| character_set_connection | latin1                     |

| character_set_database   | utf8                       |

| character_set_filesystem | binary                     |

| character_set_results    | latin1                     |

| character_set_server     | utf8                       |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.01 sec)




mysql
> SHOW VARIABLES LIKE  'col%';

+----------------------+-------------------+

| Variable_name        | Value             |

+----------------------+-------------------+

| collation_connection | latin1_swedish_ci |

| collation_database   | utf8_bin          |

| collation_server     | utf8_bin          |

+----------------------+-------------------+

3 rows in set (0.00 sec)




mysql
> SHOW VARIABLES LIKE  'expl%';

+---------------------------------+-------+

| Variable_name                   | Value |

+---------------------------------+-------+

| explicit_defaults_for_timestamp | ON    |

+---------------------------------+-------+

1 row in set (0.00 sec)




mysql
>



Thanks
-Vincent

On Wednesday, January 3, 2018 at 6:41:30 PM UTC+1, Roland Huß wrote:
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0