Bluemix Docker container cf ic run doesn't seem to accept -p sub-command

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

  • Docker in Docker: Port Mapping
  • Restoring to a neo4j docker container
  • Cannot install packages inside docker Ubuntu image
  • Gradle build fails while executing './gradlew build installDist --info' inside docker container
  • read nested variable from .env for laravel 5.1 (and docker)
  • AWS ECS running a task that requires many cores
  • 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?

  • PyCharm can't connect to interpreter in docker
  • Starting new Docker container with every new Bamboo build run and using the container to run the build in
  • Docker for Mac host network access
  • docker-compose use extra_hosts with container id
  • How to install docker version 17.04 on Amazon Linux?
  • Scripting Docker, Not Connected After Running Script?
  • 2 Solutions collect form web for “Bluemix Docker container cf ic run doesn't seem to accept -p sub-command”

    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.

    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

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.