linux - docker attach vs lxc-attach -
update: docker 0.9.0 use libcontainer now, diverting lxc see: attaching process docker libcontainer container
i'm running istance of elasticsearch:
docker run -d -p 9200:9200 -p 9300:9300 dockerfile/elasticsearch checking process show following:
$ docker ps --no-trunc container id image command created status ports names 49fdccefe4c8c72750d8155bbddad3acd8f573bf13926dcaab53c38672a62f22 dockerfile/elasticsearch:latest /usr/share/elasticsearch/bin/elasticsearch java hour ago 8 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp pensive_morse now, when try attach running container, stacked:
$ sudo docker attach 49fdccefe4c8c72750d8155bbddad3acd8f573bf13926dcaab53c38672a62f22 [sudo] password lsoave: the tty doesn't connect , prompt not back. doing same lxc-attach works fine:
$ sudo lxc-attach -n 49fdccefe4c8c72750d8155bbddad3acd8f573bf13926dcaab53c38672a62f22 root@49fdccefe4c8:/# ps -ef uid pid ppid c stime tty time cmd root 1 0 49 20:37 ? 00:00:20 /usr/bin/java -xms256m -xmx1g -xss256k -djava.awt.headless=true -xx:+useparnewgc -xx:+useconcma root 88 0 0 20:38 ? 00:00:00 /bin/bash root 92 88 0 20:38 ? 00:00:00 ps -ef root@49fdccefe4c8:/# does know what's wrong docker attach ?
nb. dockerfile/elasticsearch ends with:
entrypoint ["/usr/share/elasticsearch/bin/elasticsearch"]
you're attaching container running elasticsearch isn't interactive command. don't shell type in because container not running shell. reason lxc-attach works because it's giving default shell. per man lxc-attach:
if no command specified, current default shell of user running lxc-attach looked inside container , executed. fail if no such user exists inside container or container not have working nsswitch mechanism.
docker attach behaving expected.
Comments
Post a Comment