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.


Nevermind, found it:

lxc exec memsql1 -- bash -c "the command with | pipe"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.