简体   繁体   中英

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

To answer your overall question, do as suggested in the duplicates of this question (eg, 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM