5

for example, I have this command:

lxc launch ubuntu:18.04 memsql1
lxc exec memsql1 -- wget -O - 'https://release.memsql.com/release-aug2018.gpg'  2>/dev/null | sudo apt-key add - && apt-key list
lxc exec memsql1 apt-cache policy apt-transport-https
lxc exec memsql1 -- apt -y install apt-transport-https
lxc exec memsql1 -- echo "deb [arch=amd64] https://release.memsql.com/production/debian memsql main" | sudo tee /etc/apt/sources.list.d/memsql.list

^ the command above (2nd and last line) will pipe into host instead of container. I know that I can use lxc exec memsql1 bash then run the command inside bash, but I want to make script out of these commands.

1 Answer 1

6

Nevermind, found it:

lxc exec memsql1 -- bash -c "the command with | pipe"
1
  • 2
    Also works for scripts like lxc exec vm1 -- bash -c "./stuff.sh" Commented Jan 7, 2023 at 22:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.