All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: bobby.prani@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] tests/docker: add basic user mapping support
Date: Tue, 17 Jan 2017 19:34:34 +0800	[thread overview]
Message-ID: <20170117113434.GC6199@lemon> (raw)
In-Reply-To: <87ziiqszlt.fsf@linaro.org>

On Tue, 01/17 11:19, Alex Bennée wrote:
> >> +            if args.user:
> >> +                uid = os.getuid()
> >> +                uname = getpwuid(uid).pw_name
> >> +                scriptlet = docker_dir+"/setup_user.sh"
> >> +
> >> +                # write scriptlet
> >> +                setup = open(scriptlet, "w")
> >> +                setup.write("#!/bin/sh\n")
> >> +                setup.write("useradd -u %d -U %s" % (uid, uname))
> >> +                setup.close()
> >> +
> >> +                st = os.stat(scriptlet)
> >> +                os.chmod(scriptlet,
> >> +                         st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
> >
> > Is it cleaner we inject commands into the docker file directly?
> 
> How do you mean? Running a second docker run command after we have built
> the image?
> 
> IIRC I'd previously tried having a template approach where we took a
> docker.in and generated a final template for the build but we abandoned
> that approach.

build_image() generates a tmp_df, for "LABEL com.qemu..." (I should have named
it org.qemu.., really, it was a silly mistake). We can add an additional "RUN
useradd -u ..." line there just as well.

Fam

> 
> >
> >> +
> >>              dkr.build_image(tag, docker_dir, dockerfile,
> >>                              quiet=args.quiet, argv=argv)
> >>

      reply	other threads:[~2017-01-17 11:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 13:22 [Qemu-devel] [RFC PATCH] tests/docker: add basic user mapping support Alex Bennée
2017-01-17  9:49 ` Fam Zheng
2017-01-17 11:19   ` Alex Bennée
2017-01-17 11:34     ` Fam Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170117113434.GC6199@lemon \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=bobby.prani@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.