1

I am new to the whole containers thing. I have successfully create an unprivileged wheezy container on a debian 8.8 host using lxc 2.0.7. But when I'm trying to:

lxc-attach -n container1 -- apt-get install openssh-server

I got this error message:

Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

The PATH contains only the followings

/usr/local/bin:/usr/bin:/bin:/usr/games

I also tried to spin up some other containers with ubuntu xenial but the result were the same.

what am I missing?

Thanks in advice.

2
  • This doesn't directly answer the question, but why are you installing sshd in the container? Containers aren't VM's such that you 'log in' to them. Jun 10, 2017 at 23:10
  • @JasonMartin Installing sshd is just an example. Apt-get fails to install anything with the same message. Jun 11, 2017 at 6:31

1 Answer 1

2

Using the option --clear-env in lxc-attach did the trick.

4
  • This answer worked for me too. But did you find a "configuration-oriented" solution ? Jan 22, 2018 at 10:57
  • @Charles-EdouardCoste can you explain what do you mean by "configuration-oriented"? Jan 23, 2018 at 10:01
  • => "In a way that it's configured to work properly, without having to add an argument to the command." :) Jan 23, 2018 at 20:51
  • @Charles-EdouardCoste no I don't have. But if you want you could create an alias to lxc-attach and add the --clear-env parameter. In this way you you will never have to add --clear-env by hand to your command. Jan 24, 2018 at 6:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .