Page 1 of 1

Does 'docker attach {CONTAINER_ID}' still work?

PostPosted: Sat Sep 23, 2017 7:27 pm
by Merc
My apologies for a question that might properly be a Docker issue and not an OnlyOffice issue, but I thought it might be of general interest to administrators of OnlyOffice servers.

I am running the Community Edition of OnlyOffice and recently tried to attach to the running container of the Community Server using the (tried and true) command:

Code: Select all
sudo docker attach {CONTAINER_ID}


which resulted in a hung terminal. That is, nothing happened. Several attempts and restarts later with no progress I tried:

Code: Select all
sudo docker exec -it {CONTAINER_ID} bash


which worked fine. I got a # prompt and connected fine.

It's been a few years now and I have never had to resort to 'sudo docker exec' to connect to a container. Does anyone know if 'sudo docker attach' still works? Is one command preferred over the other?

I am running:

Docker version 17.05.0-ce, build 89658be
Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)
onlyoffice/documentserver:4.4.3.7
onlyoffice/communityserver:9.1.0.418

Thanks very much for your feedback.

Re: Does 'docker attach {CONTAINER_ID}' still work?

PostPosted: Mon Sep 25, 2017 9:34 am
by Maxim
Hello Merc!
You are right!
Have no idea why "docker attach" seems to hang and you have to use "docker exec" to execute commands in container, but it's not comfortable for me.
They say that it doesn't hang, but actually it is waiting for your input. I didn't check it.

Re: Does 'docker attach {CONTAINER_ID}' still work?

PostPosted: Wed Sep 27, 2017 7:55 pm
by Merc
In the past (actually up until this post) that condition where it does not actually hang was what I saw. I simply hit an additional carriage return and things worked as expected.

This time, no go. Nothing I did resulted in a command line prompt from the attached container. Ergo the exec command.

I'd be interested to know what you get if/when you try it.

-Thanks

Re: Does 'docker attach {CONTAINER_ID}' still work?

PostPosted: Thu Sep 28, 2017 7:57 am
by Maxim
Hello Merc!
I use "docker exec" command every time when i need instead of "docker attach".