【发布时间】:2020-05-27 08:27:54
【问题描述】:
我有一个容器,它继承自 nvidia cuda 10.2 ubuntu 18.04:
FROM nvidia/cuda:10.2-base-ubuntu18.04
# Install some basic utilities
RUN apt-get update && apt-get install -y \
curl \
wget \
ca-certificates \
sudo \
git \
bzip2 \
libx11-6 \
&& rm -rf /var/lib/apt/lists/*
# Create a working directory and set it as default
RUN mkdir /app
RUN chmod 777 /app
WORKDIR /app
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# All users can use /home/user as their home directory
ENV HOME=/home/user
RUN chmod 777 /home/user
# Install Miniconda
RUN wget -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh \
&& chmod +x ~/miniconda.sh \
&& ~/miniconda.sh -b -p ~/miniconda \
&& rm ~/miniconda.sh
ENV PATH=/home/user/miniconda/bin:$PATH
ENV CONDA_AUTO_UPDATE_CONDA=false
# Update Conda
RUN conda update conda
如果我使用环境变量 env TERM=xterm-256color 运行此容器,我将获得预期的彩色输出支持。
现在我有另一个 Docker 容器,它继承自我在上面粘贴的容器(标记:mlflowcore/base:1.0.0):
FROM mlflowcore/base:1.0.0
# Install the conda environment
COPY pytorch_environment.yml .
RUN conda env create -f pytorch_environment.yml && conda clean -a
# Activate the environment
RUN echo "source activate pytorch" > ~/.bashrc
ENV PATH /home/user/miniconda/envs/pytorch/bin:$PATH
# Dump the details of the installed packages to a file for posterity
RUN conda env export --name pytorch > pytorch.yml
# Currently required, since mlflow writes every file as root!
USER root
但是,当我使用变量 env TERM=xterm-256color 运行此容器或从 Docker 容器中设置 ENV TERM xterm-256color 变量时我没有获得颜色支持。
如何为我的容器获得颜色支持,该容器继承自基于另一个容器的 Docker 容器?
非常感谢!
【问题讨论】: