Run Command Inside of Docker Container Using Ansible

前端 未结 5 720
情话喂你
情话喂你 2020-12-07 16:48

what I\'m trying to accomplish is to run commands inside of a Docker container that has already been created on a Digital Ocean Ubuntu/Docker Droplet using Ansible.

5条回答
  •  独厮守ぢ
    2020-12-07 17:16

    Ended up doing something like that:

    - name: execute command in docker
      shell: |
        docker exec container sh -l -c "cat /tmp/secret"
      register: hello
    
    - debug: msg="{{ hello.stdout }}"
    

提交回复
热议问题