I am trying to do a more complicated task inside a running lxc ubuntu container, but my problem can be explained using this simple example. When I run
sudo lxc-attach -n container1 -- echo "test" > test.txt
inside of a shell script, I expect to find
test.txt inside of my container, but instead I find it on my host machine! What has gone wrong?