osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
559 stars 73 forks source link

Addressing rocker not capable of mounting local folders #142

Closed 130s closed 3 years ago

130s commented 3 years ago

Re-opening https://github.com/osrf/rocker/pull/46 and https://github.com/sloretz/rocker/pull/1 as a new PR rebased to the origin/main of the moment.

Issue aimed

There's no (easy) way to mount the host's volume on to the container rocker starts.

Approach

Add a volume option similar to docker run --volume option.

Review checlist includes

130s commented 3 years ago

I think the review comments in https://github.com/osrf/rocker/pull/46 are all addressed (mostly thanks to @meyerj's https://github.com/sloretz/rocker/pull/1).

meyerj commented 3 years ago

I think the review comments in #46 are all addressed (mostly thanks to @meyerj's sloretz#1).

We at Intermodalics are using this extension in the version from sloretz#1 now for a while. Note that there is an ambiguity issue with argparse if there is no other option anymore after the list of folders to mount and the image name. But from the README it seems this has been addressed here, or argparse can already understand the double-dash to separate the positional arguments.

In the meantime I also added a patch on an internal version to just pass any argument through to docker run, motivated by x11docker:

To run a Docker container on a new X server:
  x11docker IMAGE
  x11docker [OPTIONS] IMAGE [COMMAND]
  x11docker [OPTIONS] -- IMAGE [COMMAND [ARG1 ARG2 ...]]
  x11docker [OPTIONS] -- DOCKER_RUN_OPTIONS -- IMAGE [COMMAND [ARG1 ARG2 ...]]

That removes the need for some extensions that essentially just mimic the command-line usage of docker run, like this one or the Environment extension, and allows to apply special options like for memory or CPU limits, custom container IPs, start detached etc. I still wanted to submit a PR for that, if you are interested. For --mount/--volume the possibility to pass a single folder and mount it at the same path inside the container is convenient and not supported like that by docker run.

tfoote commented 3 years ago

Squashed and manually merged in dc046c7