我正在尝试在linux映像上安装YouCompleteMe vim插件。
FROM ubuntu:22.04
# minimal nix stuff ...
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install vim -y
RUN apt-get install curl -y
# pathogen stuff ...
RUN mkdir -p ~/.vim/autoload
RUN mkdir -p ~/.vim/bundle
RUN curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# for cmake annoying questions ...
ARG DEBIAN_FRONTEND=noninteractive
# dependencies ...
RUN apt install build-essential cmake vim-nox python3-dev -y
# vim stuff ...
RUN echo "execute pathogen#infect()" > ~/.vimrc
RUN echo "syntax on" >> ~/.vimrc
RUN echo "filetype plugin indent on" >> ~/.vimrc
RUN echo "color evening" >> ~/.vimrc
RUN echo "set number" >> ~/.vimrc
RUN echo "set tabstop=4" >> ~/.vimrc
RUN echo "set shiftwidth=4" >> ~/.vimrc
RUN echo "set expandtab" >> ~/.vimrc
# ycm stuff ...
RUN cd ~/.vim/bundle && git clone https://github.com/ycm-core/YouCompleteMe.git
RUN cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive
上面的步骤很好,但是当我尝试完成最后一步时:
RUN python3 ~/.vim/bundle/YouCompleteMe/install.py
我得到以下错误:
=> ERROR [20/20] RUN python3 ~/.vim/bundle/YouCompleteMe/install.py 0.4s
------
> [20/20] RUN python3 ~/.vim/bundle/YouCompleteMe/install.py:
#23 0.377 This script should not be run with root privileges.
------
executor failed running [/bin/sh -c python3 ~/.vim/bundle/YouCompleteMe/install.py]: exit code: 1
用于运行上面的Dockerfile
的docker命令是:
docker build --tag host --file Dockerfile .
发布于 2022-06-22 12:55:43
根据这个链接,https://installati.one/ubuntu/22.04/vim-youcompleteme/,我将添加这一行apt-get -y install vim-youcompleteme
因此,Docker文件将以以下开头:
FROM ubuntu:22.04
# minimal nix stuff ...
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install vim -y
RUN apt-get install curl -y
# new line I am suggesting.
RUN apt-get -y install vim-youcompleteme
发布于 2022-06-22 15:03:13
有点离题,但我建议你不要使用这么多的运行的,阅读最佳做法/
示例:
RUN apt-get update && apt-get install -y git vim curl && apt-get clean
这将使图像变得更轻
https://stackoverflow.com/questions/72715765
复制相似问题