skip to Main Content

I’m trying to install the YouCompleteMe vim plugin on a linux docker image.

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

The above steps are fine, but when I try to do the final step:

RUN python3 ~/.vim/bundle/YouCompleteMe/install.py

I get the following error:

 => 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

The docker command I use to run the Dockerfile above is:

docker build --tag host --file Dockerfile .

2

Answers


  1. According to this link, https://installati.one/ubuntu/22.04/vim-youcompleteme/, I would add this line apt-get -y install vim-youcompleteme

    So the Docker file would start with:

    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
    
    Login or Signup to reply.
  2. a little off topic, but I advise you not to use so many RUN’s, read
    https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

    example:

    RUN apt-get update && apt-get install -y git vim curl && apt-get clean
    

    this will make the image lighter

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search