【发布时间】:2021-07-13 04:42:50
【问题描述】:
我创建了一个自定义别名来在 linux 中运行 powershell。为此,我创建了一个具有该别名的 docker 映像。但是当容器以该图像启动时,我的自定义别名无法按预期工作。我不得不使用source .bashrc 重新加载 .bashrc 然后它工作。我需要在 Dockerfile 中重新加载这个 .bashrc。非常感谢任何建议。
WORKDIR /home/releases
USER root
RUN echo "alias powershell='pwsh'" >> .bashrc
#NTRYPOINT [ "bash","/opt/slave-launch.sh"]
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*
# Download the Microsoft repository GPG keys
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
RUN dpkg -i packages-microsoft-prod.deb
# Update the list of products
RUN apt-get update
# Install PowerShell
RUN apt-get install -y powershell
# Install Vim editor
RUN apt-get install vim -y
RUN source /etc/.bashrc
#ENTRYPOINT [ "bash","-c","sleep 2000"]
ENTRYPOINT [ "bash","/opt/slave-launch.sh"]
【问题讨论】:
-
请将图片替换为文字。请参阅:editing-help。
标签: linux bash ubuntu dockerfile