One - One Code All

Blog Content

在脚本中执行docker bash

Linux-Mac 容器化 运维   2015-01-01 22:36:50

在shell中执行docker shell命令返回结果给变量。


test.sh

function test(){
  result=(`bash -c "$1"`)
  echo ${result[0]}
}
test "docker exec -it  airflow /bin/bash -c 'airflow list_dags'"



执行文件:

bash  test.sh


上一篇:docker从容器里面拷文件到宿主机或从宿主机拷文件到docker容器里面
下一篇:从宿主机进入docker并运行其中命令

The minute you think of giving up, think of the reason why you held on so long.