Thoughts on attaching to Docker Container:

Especially useful for Turnkey Linux docker containers.  In some cases you need to exit the fence to continue to boot.  Then ssh back in with root to set the password.  When you attach like this – you can more or less think of this as the master console of the container.

When first bootstrapping a Turnkey Linux Container – you need to get in to setup.

to attach.

docker attach <name>

To detach

Do not press control-C – that will exit the container.

<CTRL-P> <CTRL-Q> – you will see “read escape sequence” – that means you did it!!!

 

root@core ~# docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                                      NAMES
2b905524dbcd        turnkeylinux/lapp   "/usr/sbin/start.sh"   28 minutes ago      Up 28 minutes       22/tcp, 80/tcp, 443/tcp, 12320-12322/tcp   lapp2
root@core ~# docker attach lapp2
root@2b905524dbcd /# ps
  PID TTY          TIME CMD
    1 pts/0    00:00:00 start.sh
 2588 pts/0    00:00:00 su
 2592 pts/0    00:00:00 bash
 3685 pts/0    00:00:00 ps
root@2b905524dbcd /# read escape sequence
root@core ~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2b905524dbcd turnkeylinux/lapp "/usr/sbin/start.sh" 29 minutes ago Up 29 minutes 22/tcp, 80/tcp, 443/tcp, 12320-12322/tcp lapp2
root@core ~#

 

 

 

Leave a Reply