blob: f5db36e4cce07c23571752e4897b06276b3ed7ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/ash
adduser "${PAM_USER}" "docker"
# create a location for user bind mount
# used in /opt/openslx/vmchooser/plugins/docker/includes/init-bind-mount.inc
DOCKER_TMP="/tmp/docker"
[ -e $DOCKER_TMP ] && rm -rf -- $DOCKER_TMP
[ ! -e $DOCKER_TMP ] && mkdir -p $DOCKER_TMP && chmod 0777 $DOCKER_TMP
# TODO Check if same user logs on to the system.
# if prev_user != curr_user then delete existing /tmp/virt/docker/prev_user_uid:prev_user_gid/
# This changes the subuid and subgid for the dockremap(user) to the current user and restards the docker daemon.
# Because off this change in the docker daemon, for each userns will be a directory under /tmp/virt/docker/
# so new users cannot uses previously downloade images by other user.
# But it saves the next user from using images, created by the previous user.
sed -i "s/dockremap:[0-9]\+.65536/dockremap:$(id -u ${PAM_USER}):65536/g" /etc/subuid
sed -i "s/dockremap:[0-9]\+.65536/dockremap:$(id -g ${PAM_USER}):65536/g" /etc/subgid
systemctl restart docker.service
exit 0
|