-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: add port mapping for container #833
feature: add port mapping for container #833
Conversation
Add port mapping for container. You can use: -p or --port to port binging into container --expose to expose container's port to access. pouch run -d -p 8888:80 registry.docker.com/library/nginx:latest Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
c.Assert(err, check.IsNil) | ||
|
||
command.PouchRun("rm", "-f", funcname) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good test!
CI failed due to know issue #815 |
@rudyfly could you also add test to check the exposed port works? |
Codecov Report
@@ Coverage Diff @@
## 0.2.x #833 +/- ##
==========================================
- Coverage 13.77% 13.62% -0.16%
==========================================
Files 107 107
Lines 6460 6534 +74
==========================================
Hits 890 890
- Misses 5511 5585 +74
Partials 59 59
Continue to review full report at Codecov.
|
@@ -131,18 +135,61 @@ func (c *container) config() (*types.ContainerCreateConfig, error) { | |||
} | |||
} | |||
|
|||
// parse port binding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, we could encapsulate the following code block into a function like parsePortMapping
func parsePortMapping(ports []string)(ports [string]nats, portBindings xxxx)
maybe has the incorrect type, but the similar meaning. In addition, this is much easier to write unit test cases.
LGTM |
Ⅰ. Describe what this PR did
Add port mapping for container. You can use:
-p or --port to port binging into container
--expose to expose container's port to access.
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
Signed-off-by: Rudy Zhang rudyflyzhang@gmail.com