-
Notifications
You must be signed in to change notification settings - Fork 514
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
Run command should allow specifying ports that need to be published #38
Comments
+1. This is definitely missing so far. |
I ran into this too, but there are potentially many questions to ask. You need to know which port to expose, which port you want it exposed on, and if there are multiple ports exposed in the image, then you have to do it multiple times. You could argue the "add files to workspace" command does not support exposing multiple ports. As result, I didn't do this and figured the easiest thing to do as a user was use a That said, if there are good ideas on how to ask the questions, I'm happy to do the work. |
As a short-term iterative step, perhaps provide a mechanism for having a VSCode setting that allows you to specify the specifics of |
@MicahZoltu That's a great idea. As another potential solution, we also just merged a PR that enhances this command, so that it detects the ports that the selected image exposes, and automatically publishes them on the host machine (by adding the appropriate "-p" args to "docker run"). This behavior solves the primary scenario I had in mind when I initially opened this issue, but I'd love to get your thoughts on this and discuss any further customizations we might need to add in to enable additional scenarios/requirements. |
Does it publish the port to a dynamic port (like One advantage of allowing for a setting that defines how |
The other way to do all of this is to just use Docker Compose Up/Down on the |
As a general rule, I try to avoid solutions that involve requiring users to put yet-another-file into the root of their project. I am currently working on a project that has 13 files in its root, none of which are actually source code, along with 5 folders full of even more files that are just project/build management. This means I currently have more files doing project/build management than I do actual source files (it is a small "toy" project). There is already a |
You could put a compose file in the Maybe it would make sense to have a setting that is something like |
Is everyone with Docker guaranteed to have docker-compose? I know it has always come with the installs I have done, but I don't know if that is always the case? Can you (in one command) do an interactive docker-compose? I would say the |
From the Docker docs:
So it looks like compose is not on Linux by default. |
Ran into this today as well. For scenarios where we need to start a single container (before using compose for example), it'd definitely be nice to have a prompt come up where we could specify the external:internal port. I'm normally using compose especially when multiple containers are involved, but when I'm initially trying out a custom image it'd be great to be able to specify the port when using the extension. Of course....I can always type it. :-) |
@DanWahlin Are you still running into this issue? |
Yeah - it looks like it. For example, if I right-click on nginx and select the Run option it defaults to 80:80 for the ports. I'm not seeing any prompt so there's no way to override the external:internal ports it uses without typing out the docker run command -p command. |
Since this is covered by #1321 I'm going to resolve this as a dupe of that one. |
The
Docker: Run
command that this extension adds to VS Code doesn't provide a way to specify which (if any) ports within the container should be exposed to the host. This makes it hard to use this command for many containers, and therefore, requires you to drop down to using the terminal directly. This isn't a big deal, but since theDocker: Add docker files to workspace
command asks which port to expose, it would seemingly make sense for theDocker: Run
command to provide a similar experience, for publishing ports at runtime.The text was updated successfully, but these errors were encountered: