Skip to content

mbrt/vim-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-rust

Docker image that bundles Rust lang (with rustc, cargo) and the following vim plugins:

Usage

Run this image from within your workspace. You can than edit your project using vim and usual rust commands: cargo build, cargo test, etc.

cd your/rust/workspace
docker run --rm -tiv `pwd`:/source mbrt/vim-rust

You can also debug by using rust-gdb command. If you have problems with the debugger, see the Troubleshooting section.

Troubleshooting

Debugging inside the container

Default Docker installation (as of version 1.5.0 on Ubuntu 14.04) have problems with gdb (e.g. breakpoints does not work). If you want to use gdb from within the image, you can use the following workaround (under Ubuntu):

  • Install the apparmor-utils package: sudo apt-get install apparmor-utils
  • Enable the complain mode for the docker apparmor config: sudo aa-complain /etc/apparmor.d/docker

This is needed at every reboot. If you want to persist this setting, simply edit /etc/rc.local as root and add this line before exit 0:

aa-complain /etc/apparmor.d/docker

See StevenVanAcker comment on issue #7276 of Docker.

Avoid updating the cargo registry every time a new container is started

Every time you start this image and run cargo build, cargo updates its registry, download your project dependencies and build them. This process is repeated every time you restart the container and could be annoying, especially if you start the image without an internet connection.

A first possibility to avoid that is to cache the .cargo directory in your host machine. Change the run command in this way:

cd your/rust/workspace
mkdir ~/.cargo
docker run --rm -ti -v ~/.cargo:/home/dev/.cargo -v `pwd`:/source mbrt/vim-rust

Another possibility is to create a new image to reuse later, with cached registry:

# on host
cd your/rust/workspace
docker run -tiv `pwd`:/source mbrt/vim-rust
# inside container
cargo update
exit
# on host again
# identify the container id
docker ps -a
docker commit <container-id> myself/myimage

From now on, use your new image:

cd your/rust/workspace
docker run --rm -tiv `pwd`:/source myself/myimage

About

Docker image that bundles rust with vim + plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published