default user not added to docker group, have to do su $USER?
up vote
0
down vote
favorite
I have Ubuntu 18.04. and after installing docker i added my user to docker group with the command
sudo usermod -aG docker ${USER}
and logged in
su - ${USER}
and if I check id, my user is added to docker group.
But when I reopen the terminal i cant do docker commands without sudo unless i explicitly do su ${USER}
also, I can't find docker group with the default user.
What am I missing here?
linux docker
add a comment |
up vote
0
down vote
favorite
I have Ubuntu 18.04. and after installing docker i added my user to docker group with the command
sudo usermod -aG docker ${USER}
and logged in
su - ${USER}
and if I check id, my user is added to docker group.
But when I reopen the terminal i cant do docker commands without sudo unless i explicitly do su ${USER}
also, I can't find docker group with the default user.
What am I missing here?
linux docker
2
only do a restart.
– gopy
2 days ago
4
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
1
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have Ubuntu 18.04. and after installing docker i added my user to docker group with the command
sudo usermod -aG docker ${USER}
and logged in
su - ${USER}
and if I check id, my user is added to docker group.
But when I reopen the terminal i cant do docker commands without sudo unless i explicitly do su ${USER}
also, I can't find docker group with the default user.
What am I missing here?
linux docker
I have Ubuntu 18.04. and after installing docker i added my user to docker group with the command
sudo usermod -aG docker ${USER}
and logged in
su - ${USER}
and if I check id, my user is added to docker group.
But when I reopen the terminal i cant do docker commands without sudo unless i explicitly do su ${USER}
also, I can't find docker group with the default user.
What am I missing here?
linux docker
linux docker
asked 2 days ago
Sam
6510
6510
2
only do a restart.
– gopy
2 days ago
4
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
1
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago
add a comment |
2
only do a restart.
– gopy
2 days ago
4
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
1
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago
2
2
only do a restart.
– gopy
2 days ago
only do a restart.
– gopy
2 days ago
4
4
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
1
1
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
@larsks already replied to the main question in a comment, however I would like to elaborate on the implications of that change (adding your default user to the docker
group).
Basically, the Docker daemon socket is owned by root:docker
, so in order to use the Docker CLI commands, you need either to be in the docker
group, or to prepend all docker
commands by sudo
.
As indicated in the documentation of Docker, it is risky to follow the first solution on your personal workstation, because this just amounts to providing the default user with root permissions without sudo
-like password prompt protection. Indeed, users in the docker
group are de facto root on the host. See for example this article and that one.
Instead, you may want to follow the second solution, which can be somewhat simplified by adding to your ~/.bashrc
file an alias such as:
alias docker="sudo /usr/bin/docker"
Thus, docker run --rm -it debian
will be automatically expanded to sudo /usr/bin/docker run --rm -it debian
, thereby preserving sudo
’s protection for your default user.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
@larsks already replied to the main question in a comment, however I would like to elaborate on the implications of that change (adding your default user to the docker
group).
Basically, the Docker daemon socket is owned by root:docker
, so in order to use the Docker CLI commands, you need either to be in the docker
group, or to prepend all docker
commands by sudo
.
As indicated in the documentation of Docker, it is risky to follow the first solution on your personal workstation, because this just amounts to providing the default user with root permissions without sudo
-like password prompt protection. Indeed, users in the docker
group are de facto root on the host. See for example this article and that one.
Instead, you may want to follow the second solution, which can be somewhat simplified by adding to your ~/.bashrc
file an alias such as:
alias docker="sudo /usr/bin/docker"
Thus, docker run --rm -it debian
will be automatically expanded to sudo /usr/bin/docker run --rm -it debian
, thereby preserving sudo
’s protection for your default user.
add a comment |
up vote
1
down vote
@larsks already replied to the main question in a comment, however I would like to elaborate on the implications of that change (adding your default user to the docker
group).
Basically, the Docker daemon socket is owned by root:docker
, so in order to use the Docker CLI commands, you need either to be in the docker
group, or to prepend all docker
commands by sudo
.
As indicated in the documentation of Docker, it is risky to follow the first solution on your personal workstation, because this just amounts to providing the default user with root permissions without sudo
-like password prompt protection. Indeed, users in the docker
group are de facto root on the host. See for example this article and that one.
Instead, you may want to follow the second solution, which can be somewhat simplified by adding to your ~/.bashrc
file an alias such as:
alias docker="sudo /usr/bin/docker"
Thus, docker run --rm -it debian
will be automatically expanded to sudo /usr/bin/docker run --rm -it debian
, thereby preserving sudo
’s protection for your default user.
add a comment |
up vote
1
down vote
up vote
1
down vote
@larsks already replied to the main question in a comment, however I would like to elaborate on the implications of that change (adding your default user to the docker
group).
Basically, the Docker daemon socket is owned by root:docker
, so in order to use the Docker CLI commands, you need either to be in the docker
group, or to prepend all docker
commands by sudo
.
As indicated in the documentation of Docker, it is risky to follow the first solution on your personal workstation, because this just amounts to providing the default user with root permissions without sudo
-like password prompt protection. Indeed, users in the docker
group are de facto root on the host. See for example this article and that one.
Instead, you may want to follow the second solution, which can be somewhat simplified by adding to your ~/.bashrc
file an alias such as:
alias docker="sudo /usr/bin/docker"
Thus, docker run --rm -it debian
will be automatically expanded to sudo /usr/bin/docker run --rm -it debian
, thereby preserving sudo
’s protection for your default user.
@larsks already replied to the main question in a comment, however I would like to elaborate on the implications of that change (adding your default user to the docker
group).
Basically, the Docker daemon socket is owned by root:docker
, so in order to use the Docker CLI commands, you need either to be in the docker
group, or to prepend all docker
commands by sudo
.
As indicated in the documentation of Docker, it is risky to follow the first solution on your personal workstation, because this just amounts to providing the default user with root permissions without sudo
-like password prompt protection. Indeed, users in the docker
group are de facto root on the host. See for example this article and that one.
Instead, you may want to follow the second solution, which can be somewhat simplified by adding to your ~/.bashrc
file an alias such as:
alias docker="sudo /usr/bin/docker"
Thus, docker run --rm -it debian
will be automatically expanded to sudo /usr/bin/docker run --rm -it debian
, thereby preserving sudo
’s protection for your default user.
edited 2 days ago
answered 2 days ago
ErikMD
1,8231318
1,8231318
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373592%2fdefault-user-not-added-to-docker-group-have-to-do-su-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
only do a restart.
– gopy
2 days ago
4
Changes to group credentials don't affect your current session. You just need to log out and log back in; it's not necessary to restart.
– larsks
2 days ago
1
yup! Thanks, it worked. Log out and log in. P.S. why is it necessary?
– Sam
2 days ago