0

I am trying to make this run but it retrieves this error:

fscrawler           | sed: -e expression #2, char 31: unknown option to `s'

I'm trying to run this command:

command: >
  sh -c "sed -i -e "s/{ELASTIC_PASSWORD}/${ELASTIC_PASSWORD}/g" 
  -e "s/{ELASTICSEARCH_HOST}/${ELASTICSEARCH_HOST}/g" 
  -e "s/{FSCRAWLER_HOST}/${FSCRAWLER_HOST}/g" /root/.fscrawler/job1/_settings.yaml 
  && fscrawler job1 --restart --rest"

I've tried with simple quotes and many other options (backslashes at the end as well) but couldn't make it work.

3
  • Move the commands into entrypoint file and call the file in the command Commented Feb 7, 2023 at 8:13
  • why cannot be within command? Commented Feb 7, 2023 at 8:33
  • Does this answer your question? How to call multiple multiline commands in a yml script? Commented Feb 7, 2023 at 10:49

1 Answer 1

1

SOLUTION:

docker-compose.yml

entrypoint: /path/to/entrypoint.sh
environment:
  - ELASTIC_HOST=${ELASTIC_HOST}
  - ELASTIC_USER=${ELASTIC_USER}
  - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
  - FSCRAWLER_HOST=${FSCRAWLER_HOST}

Dockerfile FSCrawler

...
COPY /host/path/to/entrypoint.sh /docker/path/to/entrypoint.sh
RUN chmod u+x /entrypoint.sh

Entrypoint

#!/bin/bash

sed -i -e "s|{ELASTIC_USER}|${ELASTIC_USER}|g" \
-e "s|{ELASTIC_PASSWORD}|${ELASTIC_PASSWORD}|g" \
-e "s|{ELASTIC_HOST}|${ELASTIC_HOST}|g" \
-e "s|{FSCRAWLER_HOST}|${FSCRAWLER_HOST}|g" /root/.fscrawler/job1/_settings.yaml 

fscrawler job1 --restart --rest
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.