Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Kubernetes Custom Dev Environment - Home directory is formatted#16344

Discussion options

Setup

  • I have installed coder on my kubernetes cluster
  • I have created a template for kubernetes deployment environments
  • I created a custom docker image usingcodercom/enterprise-base:ubuntu as base image, to install some pre-required things likenvm,gvm,pyenv andinfisical
  • When I run the docker image directly usingdocker run command, everything works exactly as expected, I have nodejs, golang, and python installed.
  • But when I set that image in kubernetes template on coder, when I create a workspace, the user's home directory/home/coder gets formatted, and all the installed apps likenvm,pyenv andgvm and.bashrc file, all gets removed, thus not usable in the environment
  • But apps installed usingapt are there likeinfisical, that's not removed.

Expected Result

  • The custom software I installed and configured in the docker image should persist when used in coder workspace.
Dockerfile Used
FROM codercom/enterprise-base:ubuntuWORKDIR /home/coderENV HOME=/home/coderENV NODE_VERSION=20USER root# Update libsENV DEBIAN_FRONTEND=noninteractiveENV TZ=Asia/KolkataRUN apt-get update && \    apt-get install -y locales && \    locale-gen en_IN.UTF-8 && \    sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \    sudo sh -c "echo $TZ > /etc/timezone"ENV LANG=en_IN.UTF-8ENV LANGUAGE=en_IN:enENV LC_ALL=en_IN.UTF-8USER coderRUN sudo apt updateRUN sudo apt install -y \    libbz2-dev \    libncurses5-dev \    libncursesw5-dev \    libffi-dev \    libreadline-dev \    libssl-dev \    zlib1g-dev \    libsqlite3-dev \    liblzma-dev \    tk-dev \    libgdbm-dev \    libdb-dev \    libexpat1-dev \    libpcap-dev \    libgmp-dev \    build-essential \    checkinstall# Install InfisicalRUN curl -1sLf \    'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' \    | sudo -E bashRUN sudo apt-get update && sudo apt-get install -y infisical# Install NVM and NodeRUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash#Install Yarn and TurboRUN . $HOME/.nvm/nvm.sh && npm install -g yarn turbo# Install pyenvRUN curl https://pyenv.run | bash && \    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \    echo 'export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"' >> ~/.bashrc && \    echo 'eval "$(pyenv init -)"' >> ~/.bashrc# Install Python 3.12.4 using pyenvRUN $HOME/.pyenv/bin/pyenv install 3.12.4 && $HOME/.pyenv/bin/pyenv global 3.12.4 && $HOME/.pyenv/bin/pyenv rehash  # Install GVMRUN sudo apt-get install -y bisonRUN bash -c "curl -s -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer | bash"RUN bash -c "source $HOME/.gvm/scripts/gvm && \    gvm install go1.21.0 -B && \    gvm use go1.21.0 --default"ENV GVM_ROOT=$HOME/.gvmENV PATH=$GVM_ROOT/bin:$PATHENV GOROOT_BOOTSTRAP=$GVM_ROOT/gos/go1.21.0ENV GOPATH=$HOME/goENV PATH=$GOPATH/bin:$GOROOT_BOOTSTRAP/bin:$PATHRUN echo "export INFISICAL_TOKEN=\$(infisical login --method=universal-auth --client-id=\$INFISICAL_CLIENT_ID --client-secret=\$INFISICAL_CLIENT_SECRET --plain --silent)" >> ~/.bashrc

Public Docker Image

  • devopsprosamples/development-environment:coder
  • 1st try to run image directly using commanddocker run -it devopsprosamples/development-environment:coder bash
  • Then try to runnode -v,python --version,go version,nvm -v.
  • Now use this image as coder workspace image, then create a workspace, and use the terminal to run the same commands again.
You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

Hi@rhythm-devopspro. Sorry for not seeing this before.

Coming to the issue is that the template mounts a volume over the home directory, which shadows the file system of the container at that path. You can either install the tools outside the home or install them in thestartup_script.

You must be logged in to vote
1 reply
@imaxun
Comment options

Can't this be deleted? I think this is very unfriendly.

Comment options

I have the same problem now, this is my dockerfile

ARG baseFROM ${base}ARG JAVA_VERSION# Dazzle does not rebuild a layer until one of its lines are changed. Increase this counter to rebuild this layer.ENV TRIGGER_REBUILD=1ENV SDKMAN_DIR=/usr/local/lib/.sdkmanRUN curl -fsSL"https://get.sdkman.io" | bash \    && bash -c". $SDKMAN_DIR/bin/sdkman-init.sh \             && sed -i 's/sdkman_selfupdate_feature=true/sdkman_selfupdate_feature=false/g' $SDKMAN_DIR/etc/config \             && sdk install gradle \             && sdk install maven \             && sdk flush archives \             && sdk install java ${JAVA_VERSION} \             && sdk install java 8.0.462-kona \             && sdk default java ${JAVA_VERSION} \             && sdk flush temp \             && mkdir $HOME/.m2"RUN mkdir -p $HOME/.bashrc.d $HOME/.zshrc.d $HOME/.m2COPY 99-java $HOME/.bashrc.d/99-javaCOPY 99-java $HOME/.zshrc.d/99-javaCOPY maven-settings.xml $HOME/.m2/settings.xml
You must be logged in to vote
1 reply
@matifali
Comment options

@imaxun, The issue is with how Docker volumes work. A volume overshadows the filesystem in the image. You should either install all tools outside of/home/coder or install them in yourstartup_script

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@rhythm-devopspro@matifali@imaxun
Converted from issue

This discussion was converted from issue #13682 on January 30, 2025 14:22.


[8]ページ先頭

©2009-2025 Movatter.jp