-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
starlord
committed
May 25, 2017
1 parent
33145e7
commit 27d5d99
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM tensorflow/tensorflow:latest-gpu | ||
RUN apt-get update -y && apt-get install sudo -y | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
DOCKER_IMAGE='tensorflow' | ||
CONTAINER_USERNAME='tensorflow' | ||
CONTAINER_GROUPNAME='tensorflow' | ||
HOMEDIR=/home/${CONTAINER_USERNAME} | ||
GROUP_ID=$(id -g) | ||
USER_ID=$(id -u) | ||
|
||
create_user_cmd() | ||
{ | ||
echo \ | ||
groupadd -f -g ${GROUP_ID} ${CONTAINER_GROUPNAME} '&&' \ | ||
useradd -u ${USER_ID} -g ${CONTAINER_GROUPNAME} ${CONTAINER_USERNAME} '&&' \ | ||
mkdir --parent ${HOMEDIR} '&&' \ | ||
chown -R ${CONTAINER_USERNAME}:${CONTAINER_GROUPNAME} ${HOMEDIR} | ||
} | ||
|
||
execute_as_cmd() | ||
{ | ||
echo sudo -u ${CONTAINER_USERNAME} HOME=${HOMEDIR} | ||
} | ||
|
||
full_container_cmd() | ||
{ | ||
echo "$(create_user_cmd) && $(execute_as_cmd) $@" | ||
} | ||
|
||
docker run -it --rm -v "$(pwd)":"${HOMEDIR}" -w "${HOMEDIR}" "${DOCKER_IMAGE}" /bin/bash -ci "$(full_container_cmd $@)" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
DOCKER_IMAGE='yocto' | ||
CONTAINER_USERNAME='yocto' | ||
CONTAINER_GROUPNAME='yocto' | ||
HOMEDIR=/home/${CONTAINER_USERNAME} | ||
GROUP_ID=$(id -g) | ||
USER_ID=$(id -u) | ||
|
||
create_user_cmd() | ||
{ | ||
echo \ | ||
groupadd -f -g ${GROUP_ID} ${CONTAINER_GROUPNAME} '&&' \ | ||
useradd -u ${USER_ID} -g ${CONTAINER_GROUPNAME} ${CONTAINER_USERNAME} '&&' \ | ||
mkdir --parent ${HOMEDIR} '&&' \ | ||
chown -R ${CONTAINER_USERNAME}:${CONTAINER_GROUPNAME} ${HOMEDIR} | ||
} | ||
|
||
execute_as_cmd() | ||
{ | ||
echo sudo -u ${CONTAINER_USERNAME} HOME=${HOMEDIR} | ||
} | ||
|
||
full_container_cmd() | ||
{ | ||
echo "$(create_user_cmd) && $(execute_as_cmd) $@" | ||
} | ||
|
||
docker run -it --rm -v "$(pwd)":"${HOMEDIR}" -w "${HOMEDIR}" "${DOCKER_IMAGE}" /bin/bash -ci "$(full_container_cmd $@)" | ||
|
||
|