Answers: <p>I suggest making a <code>cronjob</code> container that does the SQL dump and elastic index using <code>docker exec</code> commands toward the corresponding containers.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-08-27T04:22:19.990Z
Answers: but cron will not know if the DB import has been completed or not. if the import task is not complete then elastic search indexing will produce an error
Answers: Bikram
Answers: CC BY-SA 4.0
Answers: 2018-09-03T13:30:05.627Z
Answers: @Bikram wait for your dump task to exit and check its return code before running the ES indexing in one cron
Answers: HenriTel
Answers: CC BY-SA 4.0
Answers: 2018-08-23T13:29:54.620Z
Answers: 2018-08-23T13:29:54.620Z
Answers: HenriTel
Body: <p>I am trying to run a Django project in docker swarm mode. The problem is I want to index the Elastic search container which needs to be run only after postgres completes the SQL dumping process (only in the first run). How can I do this? Any solutions.</p>
  
Tags: <docker><docker-swarm><elastic>
Title: Executing a command in running docker swarm service
UserDisplayName: Bikram
ThreadText: # Executing a command in running docker swarm service
  
  (Asked by: username_0 on 2018-08-21)
  
  I am trying to run a Django project in docker swarm mode. The problem is I want to index the Elastic search container which needs to be run only after postgres completes the SQL dumping process (only in the first run). How can I do this? Any solutions.
  
  **Tags:** docker, docker-swarm, elastic
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-23. Score: 1
  
  I suggest making a `cronjob` container that does the SQL dump and elastic index using `docker exec` commands toward the corresponding containers.
  
  > **Comments:**
  > **username_0**: but cron will not know if the DB import has been completed or not. if the import task is not complete then elastic search indexing will produce an error  
  > **username_1**: @username_0 wait for your dump task to exit and check its return code before running the ES indexing in one cron  
  
  ---
  
  