Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tries to use a terminal when running under Docker, and causes requests to fail #78

Closed
emk opened this issue Mar 16, 2016 · 4 comments
Closed

Comments

@emk
Copy link

emk commented Mar 16, 2016

If I take a basic Iron app with logger 0.0.3:

fn main() {
    // Set up very basic logging to the console.
    env_logger::init();

    // Declare our REST API using Rustless, which is much tidier than using
    // bare Iron APIs.
    let api = rustless::Api::build(|api| {
        // ... SNIPPED  ...
    });
    let app = rustless::Application::new(api);

    // Put our app into a middleware chain so we can attach the logger,
    // etc.
    let mut chain = Chain::new(app);

    // Call the logger middleware at the beginning and end of our request
    // chain.
    let (logger_before, logger_after) = Logger::new(None);
    chain.link_before(logger_before);
    chain.link_after(logger_after);

    // Run our web server.
    println!("Listening on 0.0.0.0:3000");
    match Iron::new(chain).http("0.0.0.0:3000") {
        Ok(_) => {},
        Err(ref e) => println!("Could not start server: {}", e),
    }
}

…and run it under Docker as:

docker run --rm myimage

I get:

ERROR:iron::iron: Error handling:
Request {
    url: Url { scheme: "http", host: Ipv4(172.17.0.11), port: 3000, path: ["health"], username: None, password: None, query: None, fragment: None }
    method: Get
    remote_addr: V4(172.17.42.1:35256)
    local_addr: V4(0.0.0.0:3000)
}
Error was: CouldNotOpenTerminal

Running docker run --rm myimage env does not show the TERM variable as being set. But it looks like it's trying to open a terminal anyway, instead of just logging to stdout.

There's probably a way to reproduce this without docker; I'm investigating further.

@emk
Copy link
Author

emk commented Mar 16, 2016

Ah, a nice easy repro: Just run unset TERM and launch an example server.

@cholcombe973
Copy link

I just ran into this also :-/

@ChrisMacNaughton
Copy link

This happens under Upstart as well

@tomprince
Copy link
Contributor

I think this is no longer relevant, now that it logs via the log crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants