<div dir="ltr">Sorry, the bit I missed (I keep doing this) is that I'm trying to script it with commands to be pushed from the host. <div>All of the Go install instructions require the setting up of environment variables something like this:</div><div><div class="gmail-crayon-line gmail-crayon-striped-line" id="gmail-crayon-57e2780a2e147926399732-34" style="margin:0px;padding:0px 5px;border:0px;outline:0px;font-size:12px;vertical-align:baseline;font-family:monaco,monacoregular,"courier new",monospace;height:inherit;color:rgb(0,0,0);white-space:pre;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(247,247,247);line-height:inherit"><span class="gmail-crayon-r" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(128,0,128)">echo</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-s" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,128,0)">'export GOROOT=$HOME/go'</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-o" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)">>></span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-e" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,78,208)">.profile</span></div><div class="gmail-crayon-line" id="gmail-crayon-57e2780a2e147926399732-35" style="margin:0px;padding:0px 5px;border:0px;outline:0px;font-size:12px;vertical-align:baseline;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(253,253,253);font-family:monaco,monacoregular,"courier new",monospace;height:inherit;color:rgb(0,0,0);white-space:pre;line-height:inherit"><span class="gmail-crayon-r" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(128,0,128)">echo</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-s" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,128,0)">'export PATH=$PATH:$GOROOT/bin'</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-o" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)">>></span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-e" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,78,208)">.profile</span></div><div class="gmail-crayon-line gmail-crayon-striped-line" id="gmail-crayon-57e2780a2e147926399732-36" style="margin:0px;padding:0px 5px;border:0px;outline:0px;font-size:12px;vertical-align:baseline;font-family:monaco,monacoregular,"courier new",monospace;height:inherit;color:rgb(0,0,0);white-space:pre;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(247,247,247);line-height:inherit"><span class="gmail-crayon-r" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(128,0,128)">echo</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-s" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,128,0)">'export GOPATH=$HOME/work'</span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-o" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)">>></span><span class="gmail-crayon-h" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,111,224)"> </span><span class="gmail-crayon-e" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;font-family:inherit;height:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;color:rgb(0,78,208)">.profile</span></div></div><div><br></div><div>I ended up being able to pass the variables in using the following commands:</div><div>lxc exec $name --env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/:go/bin --env GOPATH=/go -- $command<br></div><div><br></div><div>Cheers,</div><div><br></div><div>Matt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 September 2016 at 20:08, Scott Lopez <span dir="ltr"><<a href="mailto:scottjl@gmail.com" target="_blank">scottjl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is more a shell question than anything particular to LXD. Just<br>
prepend the variable you want to the beginning of your command:<br>
<br>
GOPATH=/some/path/here apt install some_software<br>
<br>
for something more permanent, edit the default path variable IN the<br>
container, probably /etc/login.defs - you didn't mention what distro<br>
you're using. or add your GOPATH variable to that file.<br>
<div><div class="h5"><br>
<br>
<br>
On Tue, Sep 20, 2016 at 1:33 PM, Matt Green <<a href="mailto:mephi@mephi.co.uk">mephi@mephi.co.uk</a>> wrote:<br>
> Hi,<br>
><br>
> I'm trying to install golang in a container, I can push an "apt install"<br>
> command to make that work, but then when I try and run stuff I get an error<br>
> about environment variables "$GOPATH not set".<br>
><br>
> It looks like there's some support for setting them in LXD, but I can't work<br>
> out how to do it, or find an example. Can anyone help?<br>
><br>
> Cheers,<br>
><br>
> Matt<br>
><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> lxc-users mailing list<br>
> <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.<wbr>linuxcontainers.org</a><br>
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br>
______________________________<wbr>_________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.<wbr>linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a></blockquote></div><br></div>