Docker exec on all running containers

前端 未结 3 1416
一生所求
一生所求 2021-01-24 05:36

I am running several docker containers running on my server, and need to exec a git pull for a repository that is on all of them.

I have tried using this:



        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-24 06:03

    I'd assume you have more than one container running, and $(docker ps -q) is expanding to some_container1 606a1083d0be and it's treating 606a1083d0be as the command you want to run, which doesn't exist. Can you post the output of docker ps -q alone to confirm please? Also if you want just the latest container id, try substituting $(docker ps -ql) instead.

    Edit: in response to your confirmation, exactly what I said is happening. As for why it worked before, you likely only had one container running then.

提交回复
热议问题