| Author | Message | 
		
		  | pcelari | 
			  
				|  Posted: Thu Feb 16, 2017 10:21 pm    Post subject: auto start of MQ in Docker container not working |   |  | 
		
		  | Chevalier
 
 
 Joined: 31 Mar 2006Posts: 411
 Location: New York
 
 | 
			  
				| Hello, 
 while experimenting MQ in docker container, generally successful, I have been unable to get the QMGR start upon start of the container.
 
 With a qmgr QMGR setup in the docker image with listener at port 1414, the qmgr simply will not start despite I instructed the Dockerfile to start the qmgr with the following instructions:
 
 FROM mq:9.0
 CMD /opt/mqm/bin/strmqm QMGR
 
 or
 
 CMD ["/opt/mqm/bin/strmqm QMGR"]
 
 or
 
 CMD ["/opt/mqm/bin/strmqm", "QMGR"]
 
 But none of the above works - the qmgr is not not running upon start of the container. So, I'm really lost! Has anyone been successful in getting the qmgr running at start of a container?
 
 Any insight would be greatly appreciated.
 
 -p
 _________________
 pcelari
 -----------------------------------------
 - a master of always being a newbie
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Fri Feb 17, 2017 12:14 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| you did not specify which version of MQ... What if you source the MQ environment in your script before running the start queue manager command ?. What is the userid you are trying to run this script under?
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Fri Feb 17, 2017 4:36 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| 
   
	| fjb_saper wrote: |  
	| you did not specify which version of MQ... |  
 
   
	| pcelari wrote: |  
	| FROM mq:9.0 |  
 
   
	| fjb_saper wrote: |  
	| What if you source the MQ environment in your script before running the start queue manager command ?. |  
   I don't know if the mq:9 docker image already does this,but it doesn't hurt to put
 
   
	| Code: |  
	| RUN[". /opt/mqm/bin/setmqenv <setmqinst options>"] |  before your CMD
 _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pcelari | 
			  
				|  Posted: Fri Feb 17, 2017 9:21 pm    Post subject: |   |  | 
		
		  | Chevalier
 
 
 Joined: 31 Mar 2006Posts: 411
 Location: New York
 
 | 
			  
				| thanks for the input! 
 The way I build the base image mq:9.0 was by manually installing MQ v9 inside a running Ubuntu container, performing the sourcing, create the gm QMGR. I then then commit the container into the image mq:9.0
 
 when the base container mq:9.0 starts, the qm QMGR can be started manually with the normal command "strmqm QMGR". so the sourcing step is already complete.
 
 QMGR starts fine if I run the strmqm command manually by either mqm or root
 
 The build command output says "successfully build". Just the QMGR doesn't start upon container start. Since there seems to be no error from MQ side, there isn't any entry indicating any cause.
 _________________
 pcelari
 -----------------------------------------
 - a master of always being a newbie
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Mon Feb 20, 2017 4:48 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| Change your CMD to an ENTRYPOINT ? _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | dextermbmq | 
			  
				|  Posted: Tue Oct 16, 2018 4:29 am    Post subject: |   |  | 
		
		  | Voyager
 
 
 Joined: 26 Jul 2014Posts: 77
 
 
 | 
			  
				| Updating a old thread. 
 I was doing the same in Ubuntu container with similar approach. Create a container from Ubuntu image -->Install IBM MQ and create a queue manager --->Commit the container  to create a new Image.
 
 Achieving a scenario where the Queue Manager is automatically started can be achieved by pointing ENTRYPOINT to a shell script that starts the queue manager or configures it in whatever way needed.
 
 Dockerfile
 ----------------------
 From <IMAGE>
 COPY *.sh /usr/local/bin
 COPY *.mqsc /usr/local/bin
 RUN chmod +x /usr/local/bin/*.sh
 RUN chmod +x /usr/local/bin/*.mqsc
 RUN usermod -a -G mqm root
 ENTRYPOINT ["/usr/local/bin/mq.sh"]
 
 mq.sh
 ------------
 #!/bin/bash
 set -e
 strmqm TEST
 runmqsc TEST < /usr/local/bin/createmqobj.mqsc
 exec "$@"
 
 I have to add the root to mqm group in order to enable the queue manager start else it will give authorization error
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gbaddeley | 
			  
				|  Posted: Tue Oct 16, 2018 4:07 pm    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 25 Mar 2003Posts: 2538
 Location: Melbourne, Australia
 
 | 
			  
				| 
   
	| Quote: |  
	| I have to add the root to mqm group in order to enable the queue manager start else it will give authorization error |  root should never be in the mqm group. This can cause issues if root starts a qmgr.
 To run strmqm from root, use su - mqm -c strmqm .....
 _________________
 Glenn
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | dextermbmq | 
			  
				|  Posted: Sat Oct 20, 2018 8:34 am    Post subject: |   |  | 
		
		  | Voyager
 
 
 Joined: 26 Jul 2014Posts: 77
 
 
 | 
			  
				| Thanks for correcting me. I agree that root should never be a part of mqm. 
 Moreover, in all ideal scenarios we should not even run the container with root user. It should be something like :
 
 Run the container with a non root user--->Configure the ENTRYPOINT script to execute the MQ specific commands with mqm user.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | dextermbmq | 
			  
				|  Posted: Fri Nov 09, 2018 7:27 am    Post subject: |   |  | 
		
		  | Voyager
 
 
 Joined: 26 Jul 2014Posts: 77
 
 
 | 
			  
				| Hi Guys, 
 To clarify, does anyone know if its mandatory for us to use the IBM Provided dockerfiles and related scripts for MQ image creation (process given by IBM here : https://github.com/ibm-messaging/mq-container). Does IBM provide support only to those MQ Images created with this approach ? OR we can have an MQ image using the procedure being followed in this thread and still get support from IBM for any runtime issues with MQ.
 
 Just getting a feel that the process explained in the link https://github.com/ibm-messaging/mq-container may not be easy for someone with less scripting knowledge.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |