fussybeaver / bollard

Docker daemon API in Rust
Apache License 2.0
814 stars 127 forks source link

Looking for help: Created container seem to be not listen to export and published port #393

Closed icecloud12 closed 4 months ago

icecloud12 commented 4 months ago

Hey everyone noobish question,

having trouble in setting the container properly that would listen on the ports

image (image 1) seems like I did it correctly, it creates the container and would have something like this on Docker Desktop image (image 2) seems like it is setup correctly telling the container config that i am using port:3001 to communicate to container port 4002 image (image 3) when running it won't use the ports at all. I might messed-up somewhere but really unsure.

I hope someone could help. Thanks

icecloud12 commented 4 months ago

hello everyone is me again it was just a very beginner issue FROM

port_binding.insert(format!("{}",container_port.to_string()), Some(vec![PortBinding {

TO

port_binding.insert(format!("{}/tcp",container_port.to_string()), Some(vec![PortBinding {
    //external port
    host_port: Some(local_port.to_string()),
    //localhost
    host_ip: Some("0.0.0.0".to_string())

}]));
let host_config = HostConfig {
    port_bindings: Some(port_binding),
    ..Default::default()
};

not sure if i should be doing this? I mean it is working but not sure if this was the intended answer