Escape character in Docker command line

前端 未结 1 840
生来不讨喜
生来不讨喜 2021-01-02 00:32

I have a docker image in which I want to run the following command :

  1. echo \"1\" > /tmp/service.cfg
  2. /bin/bash
相关标签:
1条回答
  • 2021-01-02 00:56

    I found the solution, I needed to run the sh command with the -c flag like this :

    docker run -i -t debian:latest sh -c 'echo "1" > /tmp/service.cfg && cat /tmp/service.cfg'
    

    This returns 1 as expected...

    0 讨论(0)
提交回复
热议问题