Reputation: 1662
The https://www.ng.bluemix.net/docs/containers/container_cli_reference_native-docker.html says cf ic run
support -p
sub-command.
However, I have attempted many time to bind port with
cf ic run -it --name container_name -p 80:8080 registry.../ns/image_name:tag
However, port 80 is not binded but the default port which exposed by the docker which in this case 8080.
Is this a bug, or I have done something wrong?
Upvotes: 1
Views: 176
Reputation: 3233
You are using the command in the wrong way. Please take a look at the cf ic run Documentation. As you can see the syntax is:
cf ic run -p <hostPort>:<containerPort> registry.../ns/image_name:tag
That means that if you want to bind the port 80 on the container to the port 8080 on the host you should do this:
cf ic run -p 8080:80 registry.../ns/image_name:tag
The behavior that you are experiencing is correct: you are actually binding the port 8080 on the container to the 80 on the host, so it is correct that you see the 8080 open on your container.
Upvotes: 4
Reputation: 1562
your run command creates a mapping between 8080 port on your container and the 80 on hosting env: if your container exposes the 8080 port I think it should be still reachable on the containers env
Upvotes: 1