rabbitmq - How to pass supervisor an environment variable from the docker run command -


I am trying to pass a varibale to the supervisor from the docker run command so that it executes a script with variable scheme Could. We need to set it to runtime so that every developer can get his queue in the rabbit, so we do not queue each other during testing.

Docker Run Command:

  Docker Run-I-P 5672: 5672-P 9200: 9200-P 9300: 9300-P 9001: 9 001-P15672: 15672 -E "PARENT_HOSTNAME = MACHINED58" - RM - Name shovel -t dtwill / blkmesa: shovel  

Docker CMD statement (After looking at the docs, I know why the error is happening ' T: Provide an Arbitrimum Perm):

  CMD / USR / bin / supervisor  

supervisor config:

  [Program: Update_rabbit_config] command = / src / update_rabbit_config.sh redirect_stderr = true priority = 200 startecs = 3  

script supervisor runs:

  machineName = $ PARENT_HOSTNAME echo machine name = $ machineName sed -i .bak "s | | machine | / '$ machineName' / "/etc/rabbitmq/rabbitmq.config  

This error is:

  exited INFO: update_rabbit_config (Exit Status 1; Expected No)  

... So if someone knows how to accomplish this, then I will be truly grateful and a happy dance when I am enlightened.

Thank you!

[Updated] I use the recommendations in response to update relevant pieces. Also, I'm including the result of the script when I manually run it (after using nsenter to connect to the running container):

  root @ 1e2aeaa3dfb8: / Src # bash update_rabbit_config.sh Machine Name = Sed: -e Expression # 1, Four 1: Unknown command: '.'  

It seems that the environment variable is not in context.

I am not an expert for supervisor, but it is said that:

Note that the overlays used here ( environment ) will be found in the shell variable used to start the subprocessed "Supervisor". See.

I think you should remove environment = PARENT_HOSTNAME =% (PARENT_HOSTNAME) s from supervisor config.


There is also a problem with your sed command because you used single quotation marks ' will not be variable replacement. Try instead:

Name of resonance machine = $ PARENT_HOSTNAME sed -i .bak "s / | machine | $ $ PARENT_HOSTNAME /" /etc/rabbitmq/rabbitmq.config

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -