Docker exec on all running containers

前端 未结 3 1417
一生所求
一生所求 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 05:56

    Try running git command with the absolute path, sometimes helps on docker to use the absolute path to a binary:

    Also have a look at this cheatsheet:(I always use this when using docker) https://gist.github.com/ruanbekker/4e8e4ca9b82b103973eaaea4ac81aa5f

    I would suggest that you download the code from github and put it in a volume where the volume points to a directory on your local machine. That way you can work directly on code on your own computer and interact with git while working with the code. That way the docker container can directly access the code from github via the volume. Also have a look at some good practices for using git with docker, you probably wanna delete all .git files before deploying your code for security reasons. Let me know if you need help with putting the source code in a volume.

提交回复
热议问题