I'm using Ubuntu 18.04. On the manual page on how to use docker without sudo it is written that user should add himself to the docker group and perform logout/login for changes to take affect. I created a group, added my user to that group, performed su $USER and then groups command started to show the group docker in the list of groups that my user is part of. But when I close the terminal and open it again I do not see that my user is part of docker group. I still need to perform su $USER command to be able to join to the docker group again.

Why this happens?

PS. However cat /etc/group always shows that my user is part of the docker group.

Update I've also tried to logout/login from ubuntu - the result is same

Update final Restarted the system once again and changes applied(now new terminal does see current user in docker group). Perhaps some problems with ubuntu 18.04 log out process


The overall X Windows system (Gnome, KDE, etc) is forking off the terminal with the credentials it already has without triggering a new login. You need to logout completely and then log back in again for the group membership change to take effect.

In the short term, instead of an su $USER command, you can run newgrp docker in any shell to get access to that new group.

| improve this answer | |
  • is there any way not to do this on new terminal or after system restart or after logout/login? – maks Feb 1 '19 at 13:12
  • @maks It doesn't sound like you've tried a logout/login from the question. – BMitch Feb 1 '19 at 13:17
  • I've updated the question. Actually at first i wrote about logout/login process, but then encountered that it happens even in a new terminal window, so updated the question – maks Feb 1 '19 at 13:27
  • @maks If you're seeing the issue after a full logout/login, then that's a bug/defect. Others have reported this which may apply to you: bugs.launchpad.net/lightdm/+bug/1781418 – BMitch Feb 1 '19 at 13:49
  • tried to add newgrp docker to bashrc file, but after that new terminal can't be opened. Is there some prrocess that could automate newgrp docker? – maks Feb 1 '19 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.