Commit 66e08b3c authored by Victor Nikulshin's avatar Victor Nikulshin
Browse files

Pass UID and GID to docker run task as env variables

parent b8755f6e
from __future__ import unicode_literals from __future__ import unicode_literals
import os
from fabric.api import task, roles, env, local, run, lcd, execute from fabric.api import task, roles, env, local, run, lcd, execute
from fabric.colors import red, green from fabric.colors import red, green
from fabric.contrib.console import confirm from fabric.contrib.console import confirm
...@@ -54,6 +56,9 @@ def docker_tryrun(imgname, containername=None, opts='', mounts=None, cmd='', res ...@@ -54,6 +56,9 @@ def docker_tryrun(imgname, containername=None, opts='', mounts=None, cmd='', res
else: else:
containername_opt = '' containername_opt = ''
opts += ' -e USER_ID={}'.format(os.getuid())
opts += ' -e GROUP_ID={}'.format(os.getgid())
local('docker run %s %s %s %s' % (opts, containername_opt, imgname, cmd)) local('docker run %s %s %s %s' % (opts, containername_opt, imgname, cmd))
return True return True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment