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

How to know docker container Id from a devcontainer ( docker-outside-of-docker )? #9750

Open
ThePlenkov opened this issue Apr 5, 2024 · 3 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality

Comments

@ThePlenkov
Copy link

Hi!

I have a script building a docker image and running it with the volume attached to a devcontainer.

Something like this:

docker run  --volumes-from $HOSTNAME ...

So this $HOSTNAME contained the id of the devcontainer container id - which is very convenient.

However, when I have switched network mode for my devcontainer ( on purpose ) HOSTNAME became just docker-desktop.

This is not very convenient.

That's how I have thought - can't we have a dedicated variable ( also ok if it's filled from template variable in devcontainer.json ) keeping the actual container id it's running in currently.

What do you think of this>?

Thanks!

@VSCodeTriageBot VSCodeTriageBot added the containers Issue in vscode-remote containers label Apr 5, 2024
@chrmarti chrmarti added the feature-request Request for new features or functionality label Apr 8, 2024
@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone Apr 8, 2024
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@VSCodeTriageBot
Copy link
Collaborator

This feature request has not yet received the 10 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

@chrmarti
Copy link
Contributor

Using docker-outside-of-docker you could look up the container based on the labels it has. There are a few labels specific to dev containers depending on how you create the container (e.g., devcontainer.local_folder and devcontainer.config_file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants