4eixos / eixo-docker

Suite of Perl modules to interact with Docker
Apache License 2.0
18 stars 4 forks source link

Start a container with external port attached to it #3

Closed alambike closed 10 years ago

alambike commented 10 years ago

Seems that isn't possible to start a container with an external host port attached to it.

We must test this and provide some examples.

The same with an external volumes.

alambike commented 10 years ago

Works ok but is necesary, in creation, enable network because is disabled by default!!

my $c = $a->containers->create(
        Hostname => 'test',
        Cmd => ["nc", "-l", '0.0.0.0', '5555'],
        Image => "ubuntu",
        Name => "testing123",
        NetworkDisabled => "false",
        ExposedPorts => {
                 "5555/tcp" =>  {}  
         },
);

$c->start(
         "PortBindings" => { 
                 "5555/tcp" =>  [{"HostIp" =>  "0.0.0.0", "HostPort" =>  "11022" }] 
         },
         "PublishAllPorts" => "false", # true by default ¿?
         "Privileged" => "false",
);
alambike commented 10 years ago

Tested and added examples