Closed Kostanos closed 7 years ago
As an aside, why are you running as (or under) root?
Do you think this may affect?
No haha. Just curious. Most people I know try to avoid root. Usually you can expose 8080
or something inside the container and then bind to some other port on the host. Usually you use HAProxy or NGinx or ELB to forward from 80
down to some other non-protected host port on your actual hardware, which is in turn mapped to another port internally within the container :P
I think for Compose it might just be the way it handles stdout/stderr. Remember, compose is piping the stream from container-specific stdout/stderr into it's own stdout/stderr. I could be wrong, but I think that might be why. @TooTallNate thoughts?
this image is inside private VPC subnet, with only one simple microservice app, no need other users etc... the outside proxy (nginx) is forwarding traffic to it.
Regarding compose, you are right, it is piping stream, what I don't understand why in some moments it process color well in some not..
Most likely because it's nodemon
running your program and not using Pseudo-terminals, and in fact not docker-compose
's fault. That would explain why nodemon
has proper debug output and the child process doesn't.
Just a guess.
nodemon works perfectly actually. When I run from inside container manually, it shows everything.
The issue is definitely in docker-compose + debug.
docker-compose even eats some characters on simple console.log(...)
after debug(...)
which never happens if I don't use debug.
You may notice:
So I assume there is some incompatibility with docker-compose and debug;
If I were to guess, nodemon is getting tripped up on the 256 color ANSI escape codes /cc @Qix-
@TooTallNate I tried to run app without nodemon and the issue persists.
Thank you.
Ok so can you share some repro code?
Sure, just simple npm app with only two lines: https://gist.github.com/Kostanos/5e86e5e3f0f13fa76b65e18f6192bec7
My output of this one is:
as you me see "m" was added before: test This is my test for colors +0ms
string
I get the expected output actually:
What version of docker
and/or docker-compose
are you using? What OS? etc.
Here's mine:
$ docker --version
Docker version 17.06.2-ce, build cec0b72
$ docker-compose --version
docker-compose version 1.14.0, build c7bdf9e
$ docker --version
Docker version 17.05.0-ce, build 89658be
$ docker-compose --version
docker-compose version 1.9.0, build 2585387
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Will update docker-compose now, let see if it will be resolved.
With newer docker-compose version it works perfect:
docker-compose version 1.15.0, build e12f3b9
so it was the docker-compose issue.
Thank you @TooTallNate for your time and help!
Hi, when I run docker image with sh or bash colors works perfectly. But when I run
docker-compose up
withtty: true
, I see alwaysm
character on each log line, and no color, I also found that if there is some space beforedebug
colors are working well. For examplenodejs nodemon
tool is showing some debug with space and without space (see screenshot).Probably it is something more docker-compose related, but I wonder why nodemon logs some time comes with color and sometimes with
m
character??Also
ms
at the end of the line is with colors.