Open wiencko opened 2 years ago
Thanks for sending this! I personally think the easiest way right now to handle this is to customize the Docker image used for the environment from what's built in cs350-docker to include zsh
then modifying the startup shell for ch shell csci350
. Unfortunately, these ways I've thought of solving it are still pretty manual and not documented. I've included instructions below on how I tried making this change to use zsh
and will work on adding to the appropriate README.
Action Items (for me):
ch
You can build and tag a custom image locally and point --image
to this locally tagged image.
Build custom image
You can modify the Dockerfile in cs350-docker
build locally:
# use this if you don't need to build a cross-platform image
docker build -t xv6-docker:v1 .
# use this if you're on an M1 Mac and need to explicitly build for linux/amd64 architecture
docker buildx build --platform linux/amd64 -t xv6-docker:v1 .
Point ch environment to local image
The ch
command below is of course explicitly setting to /bin/zsh
assuming you've installed that in your custom image. You of course can also manually edit the ~/.ch.yaml
too since the only fields which should change are pullopts.imagename
and shell
.
# path to xv6 code
VOLUME_MNT=$HOME/workspace/csci350
ch create csci350 \
--replace \
--image xv6-docker:v1 \
--volume $VOLUME_MNT:/xv6_docker \
--security-opt seccomp:unconfined \
--port 7776:22 \
--port 7777:7777 \
--port 25000:25000 \
--cap-add SYS_PTRACE \
--shell /bin/zsh \
--privileged
ch
to build custom DockerfileNote: this will not work if you are using cs350-docker setup on an M1 because
ch
will only use the default Docker engine builder which does not support cross-platform (host: linux/arm64 -> target: linux/amd64) builds.
Using ch
to build the custom Dockerfile by providing --context
(docker build context) and --file
(path to Dockerfile, relative to context) flags instead of --image
.
This will build your custom image where you can add zsh
dependency and modify startup shell to /bin/zsh
.
# path to where the cs350-docker lives on my macbook
CS350_BUILD_CONTEXT=$HOME/workspace/cs350-docker
# path to xv6 code
VOLUME_MNT=$HOME/workspace/csci350
ch create csci350 \
--replace \
--context $CS350_BUILD_CONTEXT \
--file Dockerfile \
--volume $VOLUME_MNT:/xv6_docker \
--security-opt seccomp:unconfined \
--port 7776:22 \
--port 7777:7777 \
--port 25000:25000 \
--cap-add SYS_PTRACE \
--shell /bin/zsh \
--privileged
Thanks! I will follow up on this when I'm not so sleepy but wanted to post this before I forgot.
Is your feature request related to a problem? Please describe. Installed zsh in docker image but have to run zsh every time I launch my csci350 image.
Describe the solution you'd like Make it possible to change the startup shell from
/bin/bash
to/bin/zsh
after docker image is created.Otherwise, add some details to the readme to allow manual changes of the docker startup file so I can manually change
/bin/bash
to/bin/zsh
.Additional context Tried making the startup shell for the image to be
/bin/zsh
but thench shell csci350
doesn't work since it can't find/bin/zsh
(since zsh is not installed by default).