Rocker is an alternative to docker-compose that makes it easier to run containers with access to features of the local environment and add extra capabilities to existing docker images. I do most of my development in vscode with the devcontainers extension so this wrapper simplifies that workflow. Rather than calling rocker and then attaching vscode, this wrapper combines those actions into one command.
First, install pipx if you don't have it already:
sudo apt update && sudo apt install -y pipx
pipx ensurepath
Then install rockervsc with pipx:
pipx install --include-deps rockervsc
with uv
uv tool install rockervsc --with-executables-from rockerc,rocker
This will install rockervsc ,rockerc and rocker as a globally available tool on your system.
To run rocker and automatically launch and attach a vscode instance, run this command:
rockervsc
You can pass all the normal rocker arguments to rockervsc and it will forward them to rocker, e.g.:
rockervsc --x11 --nvidia
by default rockervsc calls rockerc so instead of passing arguments explicitly you can have a rockerc.yaml file in your workspace
image: ubuntu:22.04
args:
- nvidia
- x11
- user
- git
and running:
rockervscwill launch and attach vscode to the container with nvidia, x11, the current user id and git set up for you.
I'm not sure this is the best way of implementing rockervsc like functionality. It might be better to implement it as a rocker extension, or in rocker itself. This was just the simplest way to get started. I may explore those other options in more detail in the future.