1

I want to copy the my.cnf file present in the host server to child docker image wherever I run docker file that uses a custom base image having below command.

ONBUILD ADD locate -i my.cnf|grep -ioh 'my.cnf'|head -1 /

but above line is breaking docker file. Please share correct syntax or alternatives to achieve the same.

1
  • @asynts I know the command to copy normal file but here in my question as you can see am trying to copy the output of a linux command, please share command to achieve same. Commented Nov 29, 2018 at 5:16

1 Answer 1

1

Unfortunately, you can't declare host commands inside your Dockerfile. See Execute command on host during docker build .

Your best bet is probably to tweak your deployment scripts to locate my.cnf on the host before running docker build.

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.