0

So I am currently running Ubuntu, and I want to use the Ubuntu docker-image and mount the plugin folder (.vim/bundle) in the container to my host machine. Because there are some Plugins that are hard to Install like YouCompleteMe. I want to have a Docker Image that I can run on my Ubuntu machines, without having to install the plugins manually. My question is, is this even possible? Cause I haven't found anything yet and I don't know if its worth to invest the time into this

0

Welcome to Stackexchange!

I'm not sure there's a way to mount a directory inside docker to host.

You can create a docker image with vim and install plugins inside the container, or use existing docker vim image, e.g. this one.

Then, use a volume that would share the directory you work currently in with docker container to edit/create a file.

0

You can mount host locations into a Docker container, but not the other way round. Based on that, I see the following options:

  • You run Vim inside a Docker container, install all plugins there, add your customizations, and also use this to edit host files. These would have to be mounted into the container, which is fine if you're just editing under one user (yourself) and ideally have all files inside your home directory (then you just need to mount that). With varying access permissions and users, this would be a hassle, though. The big benefit is that you could share that Docker image between multiple hosts, and always have an identical editor. Also, if you have multiple systems with varying distributions and versions, you don't have to figure out how to set up the plugin build on each different one.
  • You just use a Vim installation inside the container to download and build the plugins, then share the .vim directory and use your host's Vim instance for editing. For sharing, there's a variety of options: container mounts, rsync / scp, docker cp (assuming you don't do plugin updates often and a semi-manual process is fine). However, this assumes that whatever plugin you build can run on your host as well. If there's compilation involved (like with YouCompleteMe), container and host environments need to be similar enough (i.e. same shared libraries (versions), dependencies). But if they are so close (i.e. same Ubuntu distribution), compilation (and sharing from) should also be fine directly on the host itself, so you don't gain much by using a container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.