Skip to content

Commit cee8634

Browse files
committed
Update Docker setup.
1 parent d95bb5c commit cee8634

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ RUN useradd -m -s /bin/bash cs61-user && \
8888
echo "cs61-user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/cs61-init
8989

9090
# create binary reporting version of dockerfile
91-
RUN (echo '#\!/bin/sh'; echo 'echo 14') > /usr/bin/cs61-docker-version; chmod ugo+rx,u+w,go-w /usr/bin/cs61-docker-version
91+
RUN (echo '#\!/bin/sh'; echo 'echo 15') > /usr/bin/cs61-docker-version; chmod ugo+rx,u+w,go-w /usr/bin/cs61-docker-version
9292

9393
# git build arguments
9494
ARG USER=CS61\ User
@@ -103,6 +103,7 @@ RUN git config --global user.name "${USER}" && \
103103
cat /dev/null > ~/.bash_profile && \
104104
echo "# 2022: avoid a Docker bug with user mapping by listing working directory" >> ~/.bash_profile && \
105105
echo "ls -al > /dev/null" >> ~/.bash_profile && \
106+
echo "for i in \`mount | grep /home/cs61-user | sed 's/^.*\\(\\/home[^ ]*\\).*/\\\\1/'\`; do ls -al \$i > /dev/null; done" >> ~/.bash_profile && \
106107
echo "# make ssh-auth.sock user-readable" >> ~/.bash_profile && \
107108
(echo "if test -f /run/host-services/ssh-auth.sock; then"; echo " sudo chown cs61-user:cs61-user /run/host-services/ssh-auth.sock"; echo "fi") >> ~/.bash_profile && \
108109
echo ". ~/.bashrc" >> ~/.bash_profile && \

docker/Dockerfile.arm64

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ RUN useradd -m -s /bin/bash cs61-user && \
120120
echo "cs61-user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/cs61-init
121121

122122
# create binary reporting version of dockerfile
123-
RUN (echo '#\!/bin/sh'; echo 'if test "x$1" = x-n; then echo 13; else echo 13.arm64; fi') > /usr/bin/cs61-docker-version; chmod ugo+rx,u+w,go-w /usr/bin/cs61-docker-version
123+
RUN (echo '#\!/bin/sh'; echo 'if test "x$1" = x-n; then echo 15; else echo 15.arm64; fi') > /usr/bin/cs61-docker-version; chmod ugo+rx,u+w,go-w /usr/bin/cs61-docker-version
124124

125125
# git build arguments
126126
ARG USER=CS61\ User
@@ -132,7 +132,12 @@ RUN git config --global user.name "${USER}" && \
132132
git config --global user.email "${EMAIL}" && \
133133
(echo "(custom-set-variables"; echo " '(c-basic-offset 4)"; echo " '(indent-tabs-mode nil))") > ~/.emacs && \
134134
(echo "set expandtab"; echo "set shiftwidth=4"; echo "set softtabstop=4") > ~/.vimrc && \
135-
(echo "if test -f /run/host-services/ssh-auth.sock; then"; echo " sudo chown cs61-user:cs61-user /run/host-services/ssh-auth.sock"; echo "fi") > ~/.bash_profile && \
135+
cat /dev/null > ~/.bash_profile && \
136+
echo "# 2022: avoid a Docker bug with user mapping by listing working directory" >> ~/.bash_profile && \
137+
echo "ls -al > /dev/null" >> ~/.bash_profile && \
138+
echo "for i in \`mount | grep /home/cs61-user | sed 's/^.*\\(\\/home[^ ]*\\).*/\\\\1/'\`; do ls -al \$i > /dev/null; done" >> ~/.bash_profile && \
139+
echo "# make ssh-auth.sock user-readable" >> ~/.bash_profile && \
140+
(echo "if test -f /run/host-services/ssh-auth.sock; then"; echo " sudo chown cs61-user:cs61-user /run/host-services/ssh-auth.sock"; echo "fi") >> ~/.bash_profile && \
136141
echo ". ~/.bashrc" >> ~/.bash_profile && \
137142
echo "export PATH=/usr/x86_64-linux-gnu/bin:\$PATH" >> ~/.bashrc && \
138143
rm -f ~/.bash_logout && \

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ cs61-lectures
126126
cs61-user@a15e6c4c8dbe:~$ echo "Hello, world"
127127
Hello, world
128128
cs61-user@a15e6c4c8dbe:~$ cs61-docker-version
129-
14
129+
15
130130
cs61-user@a15e6c4c8dbe:~$ exit
131131
exit
132132
$

0 commit comments

Comments
 (0)