Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension to support docker from docker #269

Open
tfoote opened this issue Mar 4, 2024 · 5 comments
Open

Add extension to support docker from docker #269

tfoote opened this issue Mar 4, 2024 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tfoote
Copy link
Collaborator

tfoote commented Mar 4, 2024

Not Docker in Docker but mounting the docker socket inside to enable calling the host daemon from inside

Following https://stackoverflow.com/a/33003273/604099

I've tested it working manually with just the docker socket mount.

rocker --volume /var/run/docker.sock:/var/run/docker.sock -- ros:rolling

@tfoote tfoote added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 4, 2024
@miguelprada
Copy link
Contributor

I've been using this approach for some time without much issue in my extension. Note that one also installs the docker CLI inside the container, which may or may not be a desired feature.

One thing one needs to be somewhat careful about when doing this is bind mounts. Since the daemon is running on the host, you can only bind mount folders from the host filesystem, not folders from the filesystem inside the container. This has already bitten me a couple of times until I realized what was going on.

@tfoote
Copy link
Collaborator Author

tfoote commented Mar 5, 2024

Thanks for the validation and warnings. Those are good insights about the mounting restrictions. I wonder if there's a way to help make that more visible when inside. And installing docker into the container is defintely a good idea if possible.

As well the docker group pass through would be good to do automatically.

@tanishapritha
Copy link

Hi @tfoote,

I’d like to work on this issue if it’s still open. I can include Docker socket mounting, install the Docker CLI in the container, and handle the group pass-through. Please let me know if I can proceed or if there’s anything specific I should consider.

Thanks,
Tanisha

@tfoote
Copy link
Collaborator Author

tfoote commented Jan 16, 2025

A contribution of an extension to do this would be great. If you're not sure what's going to be necessary I suggest that you write out a outline of what you think will be necessary and we can give you feedback here in the thread to make sure you're going to be on track when you start your implementation.

@tanishapritha
Copy link

Here’s what I plan on doing:

  • Mount the Docker socket (/var/run/docker.sock) into the container. This will allow the container to send commands to the Docker daemon running on the host.
  • Install the Docker CLI inside the container so that commands like docker ps or docker run can be executed from within.
  • Set up the Docker group inside the container to make sure there are no access or permission issues when interacting with the socket.
  • Test the setup by running common Docker commands from inside the container to ensure it works as expected (e.g., starting another container or checking container statuses).

Let me know if this works or if I’m off track—I’d really appreciate guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants