'AWS workspaces Golden Image Linux - Adding provisioned user to docker group
I created a linux golden image for aws workspaces with docker installed on it. I provisioned the workspace bundle to an AD user.
docker version gave -
Client:
Version: 19.03.13-ce
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46
Built: Mon Oct 12 18:51:20 2020
OS/Arch: linux/amd64
Experimental: fals
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/version: dial unix /var/run/docker.sock: connect: permission denied
how can I add the provisioned user to docker group? I have tried sudo usermod -aG docker username, but aws workspaces gives an error saying - "usermod: user "username" does not exist.
Please help
Solution 1:[1]
To answer your overall question, do as suggested in the duplicates of this question (e.g., here, here, and here). I see that you have already attempted this, but you have forgotten to replace "username" in the command sudo usermod -aG docker username
with an actual username.
If the user calling the command is the one which needs to be added to the group, you may use sudo usermod -aG docker $(whoami)
instead. Bash will then replace $(whoami)
with the current user's username.
Note that in order for the changes to take effect, as mentioned in the other posts, on many systems you will then likely need to either run newgrp docker
once per terminal session or reboot the system. If anyone knows how to avoid that extra step, I would love to learn how!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | gmarmstrong |