Is it possible to make docker's container output colored?

Viewed 521

I packed up my Spring-boot application into docker's container. Now the application's output is no longer colored. How can I fix it?

2 Answers

Actually what you are seeing when running your docker image is your application logs received from the docker engine (daemon server), but not directly from the spring application. In other words, in Docker, your application is running externally in a container but the docker server is coping real-time logs in JSON format to display it as a container output that's why it's not colored.

check the ccze Linux package it can solve the problem. Here is a related issue how-to-colorize-logs-for-docker-container

If you run your container with the -it flag you may see colored output. Ex:

docker run -it --rm springio/gs-spring-boot-docker

More info about the -it flag: what is docker run -it flag?

Related