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.

sudhir tataraju
  • 1,159
  • 1
  • 14
  • 30
  • @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. – sudhir tataraju Nov 29 '18 at 05:16

1 Answers1

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.

Max
  • 9,220
  • 10
  • 51
  • 83