osrf / rocker

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

rocker images are placed into default context #203

Open karlhm76 opened 1 year ago

karlhm76 commented 1 year ago

Hello,

I have been able to use rocker to create a docker image for ROS development but the image is created in the default context. I generally use a different docker context due to using management tools and development tools.

There seems to be no way to direct the image to be created in a different context other than default.

I have changed the CLI docker context to the correct one prior to running the rocker command, I have also set the DOCKER_CONTEXT environment variable. Neither of these has any effect on where the image is created.

It would be ideal if rocker could detect the current context and create the images in that context.

`$ rocker osrf/ros:noetic-desktop-full bash --x11 Extension volume doesn't support default arguments. Please extend it. Active extensions ['x11'] Writing dockerfile to /tmp/tmpi31oupme/Dockerfile vvvvvv

Preamble from extension [x11]

FROM osrf/ros:noetic-desktop-full USER root

Snippet from extension [x11]

^^^^^^ Building docker file with arguments: {'path': '/tmp/tmpi31oupme', 'rm': True, 'nocache': False, 'pull': False} building > Step 1/2 : FROM osrf/ros:noetic-desktop-full building > ---> fa623f74fdb4 building > Step 2/2 : USER root building > ---> Running in a39252e2bbfb building > Removing intermediate container a39252e2bbfb building > ---> 23a704122dca building > Successfully built 23a704122dca Executing command: docker run --rm -it -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=/tmp/.dockerazsql75c.xauth -v /tmp/.dockerazsql75c.xauth:/tmp/.dockerazsql75c.xauth -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro 23a704122dca bash Unable to find image '23a704122dca:latest' locally docker: Error response from daemon: pull access denied for 23a704122dca, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'.`

checking images in desktop-linux context: $ export DOCKER_CONTEXT=desktop-linux $ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE portainer/portainer-docker-extension 2.15.1 500504ac663a 4 weeks ago 285MB osrf/ros noetic-desktop-full 16ee7f7bf08e 6 weeks ago 3.44GB

checking images in default context: `$ export DOCKER_CONTEXT=default $ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE

23a704122dca 17 minutes ago 3.44GB osrf/ros noetic-desktop-full fa623f74fdb4 10 days ago 3.44GB ` Thank you.
tfoote commented 1 year ago

This looks like a great feature to add to rocker. I haven't used contexts much myself but they look powerful for other use cases and don't look to complicated for rocker to interact with.

Detecting the context and passing it through as well as being able to override it from the command line options would be a great capability to add to rocker.