Container ... is not defined on lxc-attach

I had same issue and I found a workaround that is adding -f option

CID=$(docker inspect --format "{{.Id}}" my_container)
sudo lxc-attach -n $CID -f /var/lib/docker/containers/$CID/config.lxc -- bash -c "..."
4 Likes