GithubHelp home page GithubHelp logo

Comments (4)

fussybeaver avatar fussybeaver commented on July 30, 2024

Bollard aligns with the Swagger specification as much as possible:

https://github.com/moby/moby/blob/master/api/swagger.yaml#L1230-L1245

As the example is "80/tcp": {} this translates to HashMap<&str, HashMap<(), ()>>

from bollard.

bpmooch avatar bpmooch commented on July 30, 2024

Ok, thanks for the clarification on the shape of the API.

I am finding that I don't understand how to create the right hashmap such that 9000/tcp is exposed on localhost for a container I start with bollard. For clarification, I am attempting to emulate docker run -d --rm -p "9000:9000" minio/minio:latest server /data with the following bollard::container::Config :

    let minio_config = Config {
        image: Some(MINIO_IMAGE),
        exposed_ports: Some(HashMap::from([
            ("9000:9000", empty.clone()),
            // ("9001:9001", empty.clone()),
        ])),
        env: Some(vec![
            "MINIO_ROOT_USER=testuser",
            "MINIO_ROOT_PASSWORD=testpass",
        ]),
        // no need to start console when controlling with docker exec and opendal
        cmd: Some(vec!["server", "/data"]),
        ..Default::default()
    };

Am I using the wrong part of the API to accomplish this?

After some more investigation, it looks like I should be utilizing host_config?

from bollard.

dmartin avatar dmartin commented on July 30, 2024

After some more investigation, it looks like I should be utilizing host_config?

Yep, exposing and publishing ports are different. See similar discussion in this issue: #340

from bollard.

bpmooch avatar bpmooch commented on July 30, 2024

Thank you! This issue can be closed now

from bollard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.