File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "user" : {
33 "user-id" : 1001 ,
4- "group-id" : 121
4+ "group-id" : 121 ,
5+ "docker-group-id" : 500
56 },
67 "install" : [
78 {
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ function group_id() {
1313 jq -r ' .user."group-id"' " $( config_file) "
1414}
1515
16+ function docker_group_id() {
17+ jq -r ' .user."docker-group-id"' " $( config_file) "
18+ }
19+
1620function apt_packages() {
1721 jq -r ' .install[] | select(.source == "apt") | .packages[]' " $( config_file) " | paste -sd ' ' -
1822}
Original file line number Diff line number Diff line change @@ -38,11 +38,25 @@ function install_git-lfs() {
3838 rm -rf /tmp/lfs.tar.gz " /tmp/git-lfs-${GIT_LFS_VERSION} "
3939}
4040
41+ function configure_docker_group_id() {
42+ local desired_gid=" $( docker_group_id) "
43+ local current_gid=$( getent group docker | cut -d: -f3)
44+
45+ if [[ " $current_gid " != " $desired_gid " ]]; then
46+ # Expected to fail if the group already exists or the GID is already in use
47+ groupadd --system --gid " $desired_gid " docker 2> /dev/null || true
48+ fi
49+ }
50+
4151function install_docker-cli() {
52+ configure_docker_group_id
53+
4254 apt-get install -y docker-ce-cli --no-install-recommends --allow-unauthenticated
4355}
4456
4557function install_docker() {
58+ configure_docker_group_id
59+
4660 apt-get install -y docker-ce docker-ce-cli docker-buildx-plugin containerd.io docker-compose-plugin --no-install-recommends --allow-unauthenticated
4761
4862 echo -e ' #!/bin/sh\ndocker compose --compatibility "$@"' > /usr/local/bin/docker-compose
You can’t perform that action at this time.
0 commit comments