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

Change getExposedPorts to return port w/ protocol #349

Merged
merged 3 commits into from
Aug 14, 2018
Merged

Conversation

PrashanthCorp
Copy link
Contributor

Fixes #284

@PrashanthCorp PrashanthCorp requested review from lostintangent, chrisdias and a team August 3, 2018 00:18
@@ -29,7 +29,7 @@ export async function startContainer(context?: ImageNode, interactive?: boolean)
docker.getExposedPorts(imageToStart.Id).then((ports: string[]) => {
let options = `--rm ${interactive ? '-it' : '-d'}`;
if (ports.length) {
const portMappings = ports.map((port) => `-p ${port}:${port}`);
const portMappings = ports.map((port) => `-p ${port.split("/")[0]}:${port}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment with what you're expecting and the output you're going for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current output:
-p 8080:8080

output I'm going for:
-p 8080:8080/tcp , -p 3010:3010/tcp

Notice the difference in 8080/tcp. Earlier, we stripped the protocol when returning the function (see getExposedPorts).

The earlier command was:
docker run --rm -d -p 8080:8080 node-todo:latest
Now with the change:
docker run --rm -d -p 8080:8080/tcp node-todo:latest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted code comments. If you need to explain it to me, you need to explain it to code maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my bad. Added comment

@@ -29,7 +29,7 @@ export async function startContainer(context?: ImageNode, interactive?: boolean)
docker.getExposedPorts(imageToStart.Id).then((ports: string[]) => {
let options = `--rm ${interactive ? '-it' : '-d'}`;
if (ports.length) {
const portMappings = ports.map((port) => `-p ${port}:${port}`);
const portMappings = ports.map((port) => `-p ${port.split("/")[0]}:${port}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there are testcases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@PrashanthCorp PrashanthCorp merged commit b6985f6 into master Aug 14, 2018
@PrashanthCorp PrashanthCorp deleted the ps/284 branch September 6, 2018 23:27
@microsoft microsoft locked and limited conversation to collaborators Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants