Is there any way to specify the group name AND id for a group with docker run --group-add? -


currently have following in script:

docker_group_id=$(cut -d: -f3 < <(getent group docker)) ... docker run --group-add ${docker_group_id} ... 

problem when run script, messages following in resultant container time:

groups: cannot find name group id 999 

solution:

based on answer @tarunlalwani have following in script:

docker_group_id=$(cut -d: -f3 < <(getent group docker)) cmd="docker run -d \                                                                                                                                                                                                                                                                                                                                                                          --group-add ${docker_group_id} \                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ${idea_image}"  echo $cmd container=$($cmd)  # post-configuration                                                                                                                                                                                                                                                                                                                                                          docker exec --user=root -it $container groupadd -g $docker_group_id docker                                                                                                                                                                                                                                                                                                     docker attach $container 

that expected behavior because group id inserted inside container , not name. can run id command see group names not passed group id

the way around run command groupadd -g 999 docker. add group file also. have execute , docker won't you


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -