[lxc-users] lxd lxc exec command to container tries to execute on Host instead?

brian mullan bmullan.mail at gmail.com
Mon Jan 4 16:46:39 UTC 2016


I was working on a bash script to automate some LXD/LXC container setups.

I successfully created the container cn1

I successfully added a new User to cn1

I successfully PUSHed several script files to the Home directory of the new
User in CN1

However, when I try to chmod +x those scripts using:



*      lxc exec cn1 -- chmod +x /home/$USER/*.sh*it seems to be trying to
do it on the Host instead & fails!

I have searched but can't find a reason why or if I am using the exec
command wrong.

A snippit of my Host script is below:



*   lxc remote add images images.linuxcontainers.org
<http://images.linuxcontainers.org>  # this works*

*   # launch as a Priviliged container *













*   lxc launch images:ubuntu/wily/amd64 cn1 -c security.privileged=true  #
this works   # create the new User in BOTH cn1 container   lxc exec cn1 - -
adduser $USER     # this works
#----------------------------------------------------------------------------------------------------------------
# Next pushing the appropriate script to its now running container.
#-----------------------------------------------------------------------------------------------------------------
lxc file push ./mk-cn1-environment.sh cn1/home/$USER/     # this works   #
make sure bash scripts we pushed are executable --  THIS FAILS   lxc exec
cn1 - - chmod +x /home/$USER/*.sh*


That last command outputs the following error messages:




*    $ lxc exec cn1 -- chmod +x /home/$USER/*.sh    chmod: cannot access
'/home/bmullan/createlxc.sh': No such file or directory    chmod: cannot
access '/home/bmullan/deletelxc.sh': No such file or directory    chmod:
cannot access '/home/bmullan/mkcn.sh': No such file or directory*


However, those .sh files are on my Host in /home/bmullan NOT the ones I
pushed
to cn1 in /home/bmullan ?

Am I using lxc exec incorrectly somehow ?

thanks for any advice.

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20160104/dab713c7/attachment.html>


More information about the lxc-users mailing list