[Openstack] About ' Port Mapping ' in openstack project Zun

谭 明宵 tanmingxiao at outlook.com
Wed Mar 7 09:28:22 UTC 2018



I want to  create a container use Zun,  like the docker command

docker run -p ip:hostPort:containerPort OPTIONS

so i can access the container_port via hostip:hostport ,but i can't find some similar commands in Zun Command Line

usage: zun run [-n <name>] [--cpu <cpu>] [-m <memory>] [-e <KEY=VALUE>]
               [--workdir <workdir>] [--auto-remove] [--label <KEY=VALUE>]
               [--image-pull-policy <policy>] [--restart <restart>] [-i]
               [--image-driver <image_driver>]
               [--security-group <security-group>] [--hint <key=value>]
               [--net <auto, network=network, port=port-uuid,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr>]
               [--mount <mount>] [--runtime <runtime>] [--hostname <hostname>]
               <image> ...

Run a command in a new container.

Positional arguments:
  <image>               name or ID of the image
  <command>             Send command to the container

Optional arguments:
  -n <name>, --name <name>
                        name of the container
  --cpu <cpu>           The number of virtual cpus.
  -m <memory>, --memory <memory>
                        The container memory size in MiB
  -e <KEY=VALUE>, --environment <KEY=VALUE>
                        The environment variables
  --workdir <workdir>   The working directory for commands to run in
  --auto-remove         Automatically remove the container when it exits
  --label <KEY=VALUE>   Adds a map of labels to a container. May be used
                        multiple times.
  --image-pull-policy <policy>
                        The policy which determines if the image should be
                        pulled prior to starting the container. It can have
                        following values: "ifnotpresent": only pull the image
                        if it does not already exist on the node. "always":
                        Always pull the image from repository."never": never
                        pull the image
  --restart <restart>   Restart policy to apply when a container exits(no, on-
                        failure[:max-retry], always, unless-stopped)
  -i, --interactive     Keep STDIN open even if not attached, allocate a
                        pseudo-TTY
  --image-driver <image_driver>
                        The image driver to use to pull container image. It
                        can have following values: "docker": pull the image
                        from Docker Hub. "glance": pull the image from Glance.
  --security-group <security-group>
                        The name of security group for the container. May be
                        used multiple times.
  --hint <key=value>    The key-value pair(s) for scheduler to select host.
                        The format of this parameter is
                        "key=value[,key=value]". May be used multiple times.
  --net <auto, network=network, port=port-uuid,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr>
                        Create network enpoints for the container. auto: do
                        not specify the network, zun will automatically create
                        one. network: attach container to the specified
                        neutron networks. port: attach container to the
                        neutron port with this UUID. v4-fixed-ip: IPv4 fixed
                        address for container. v6-fixed-ip: IPv6 fixed address
                        for container.
  --mount <mount>       A dictionary to configure volumes mounted inside the
                        container.
  --runtime <runtime>   The runtime to use for this container. It can have
                        value "runc" or any other custom runtime.
  --hostname <hostname>
                        Container hostname





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20180307/28911977/attachment.html>


More information about the Openstack mailing list