Re: [lxc-users] Setting PATH environment variable, or installing golang in a container

2016-09-21 Thread Matt Green
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.
All of the Go install instructions require the setting up of environment
variables something like this:
echo 'export GOROOT=$HOME/go' >> .profile
echo 'export PATH=$PATH:$GOROOT/bin' >> .profile
echo 'export GOPATH=$HOME/work' >> .profile

I ended up being able to pass the variables in using the following commands:
lxc exec $name --env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/:go/bin
--env GOPATH=/go -- $command

Cheers,

Matt

On 20 September 2016 at 20:08, Scott Lopez  wrote:

> This is more a shell question than anything particular to LXD. Just
> prepend the variable you want to the beginning of your command:
>
> GOPATH=/some/path/here apt install some_software
>
> for something more permanent, edit the default path variable IN the
> container, probably /etc/login.defs - you didn't mention what distro
> you're using. or add your GOPATH variable to that file.
>
>
>
> On Tue, Sep 20, 2016 at 1:33 PM, Matt Green  wrote:
> > Hi,
> >
> > I'm trying to install golang in a container, I can push an "apt install"
> > command to make that work, but then when I try and run stuff I get an
> error
> > about environment variables "$GOPATH not set".
> >
> > It looks like there's some support for setting them in LXD, but I can't
> work
> > out how to do it, or find an example. Can anyone help?
> >
> > Cheers,
> >
> > Matt
> >
> >
> >
> > ___
> > lxc-users mailing list
> > lxc-users@lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Setting PATH environment variable, or installing golang in a container

2016-09-20 Thread Scott Lopez
This is more a shell question than anything particular to LXD. Just
prepend the variable you want to the beginning of your command:

GOPATH=/some/path/here apt install some_software

for something more permanent, edit the default path variable IN the
container, probably /etc/login.defs - you didn't mention what distro
you're using. or add your GOPATH variable to that file.



On Tue, Sep 20, 2016 at 1:33 PM, Matt Green  wrote:
> Hi,
>
> I'm trying to install golang in a container, I can push an "apt install"
> command to make that work, but then when I try and run stuff I get an error
> about environment variables "$GOPATH not set".
>
> It looks like there's some support for setting them in LXD, but I can't work
> out how to do it, or find an example. Can anyone help?
>
> Cheers,
>
> Matt
>
>
>
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users