For some reason I cannot enter a docker container using Lxc-attach only on EC2 instances. This works on my local machine and on Digital Ocean (KVM) droplets but not on Amazon EC2 xen-paravirtualized Ubuntu12.04 instance. Here are the steps/errors:

root@ip-172-31-46-202:~/scalar/project/docker# lxc-ls
4074ebf985cfe09b2880a9eabbc7ad3e59283f425f64cfaa72f59f1f23661d18

root@ip-172-31-46-202:~/scalar/project/docker# lxc-attach -n 4074ebf985cfe09b2880a9eabbc7ad3e59283f425f64cfaa72f59f1f23661d18
lxc-attach: No such file or directory - failed to open '/proc/19731/ns/pid'
lxc-attach: failed to enter the namespace

Does anyone know if there is a way to resolve this issue? Here are my docker version details:

Client version: 0.7.6
Go version (client): go1.2
Git commit (client): bc3b2ec
Server version: 0.7.6
Git commit (server): bc3b2ec
Go version (server): go1.2
Last stable version: 0.7.6

Also:

lxc version: 0.7.5
有帮助吗?

解决方案

What is your kernel version?

lxc-attach requires features that are not present in the native 12.04 kernel (3.5). You need at least 3.8 which IIRC is available in the backport.

其他提示

As Creac suggested, the kernel was not of a high enough version. (and if I try re-deploying an AWS ubuntu image it still uses kernel 3.2)

To fix this issue, I ran the following command to get 3.8:

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

or you can run the following command to get 3.5

sudo apt-get install linux-image-generic-lts-quantal linux-headers-generic-lts-quantal

Please note that these commands are Ubuntu specific (as per the question) and will install the "generic" kernel rather than the "virtual" kernel, but should work. [source]

Note that I tried to update Creac's original answer with this additional information but the edit was rejected so I felt the need to create a new answer for others to use if they want.

source of where I found the commands

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top