I have a rust project that is running in a docker. It is there where the emulator and all dependencies are setup so my own host pc doesnt need to install anything.
I am using vim witch Coc and coc-rust-analyser installed so I can locally create and debug my own local projects. But the ones in the docker , how can I work with that code and get correct lint errors etc? Because if I open a project from the docker, since the container has mapped the folder to a folder in my local host folder, I can open the project with vim, but I get a bunch of lint errors ofcourse since dependencies etc that is installed in the docker is not installed in my host pc. And I do not want to install these dependencies ofcourse since this is specific for this container and the projects inside it.
What susggestion do you guys have in such development situation?
simplest thing is probably just to run the ide in the container
I tried that but even though I have added my username to the docker group I can not just install things in the docker... Im no docker expert so Im not sure why I cant do that. Hence I can not install probe-rs for example or anything else which I need for the rust project. Have you some guidelines for such setup?
Hi, vscode devcontainers are quite nice for developing inside a container.
I use devcontainers (in vscode) all the time.
- For vim I found this, which might help: Running Neovim with Devcontainers | Coding with Coffee
- I keep a custom docker image with the handful of tools I always want and it gets built weekly and put on github.io MusicalNinjas/pyo3-devcontainer (I intend to split out the core rust stuff very soon into a neater base image)
- devcontainers themselves publish base images for most languages (including rust) but I would rather choose the minmal tooling for my project and be clear about what's needed than just have a swiss-army-knife-toolbox
- If you want to extend a base docker image you have two options:
- use devcontainer "features" easy to find via the link above - slower as these get run more often locally and can't be built in CI as a personal base image
- add a minimal Dockerfile to your repo (example: splurt/.devcontainer/Dockerfile at main ยท MusicalNinjaDad/splurt)
- just open a terminal in the container (via your IDE) and install the tool but you'll loose it every time you rebuild