Jesse Whitham
Jesse Whitham

Reputation: 824

How do I not create docker container logs?

So my Hard drive space filled up today after starting up a container as a daemon:

sudo docker run -d --name nexpose-server nexpose

After I found the logs file of my container I realised that running my container had spawned a 177GB log file (all my free hard drive space).

I know this is not usual behaviour but the process in the container prints a lot of data to stdout. Most of the output is generated in the first 30 odd minutes as it updates itself initializes databases etc.

I would like to be able to either disable saving the logs or pipe the stdout to something like /dev/null. Is this possible? Has anyone got any better ideas?

Upvotes: 10

Views: 6996

Answers (2)

Pavel
Pavel

Reputation: 668

Starting from Docker 1.6 you can use --log-driver=none when you run your container. See examples here: https://www.sumologic.com/2015/04/16/new-docker-logging-drivers/

Upvotes: 17

steakunderscore
steakunderscore

Reputation: 1116

This should work:

CMD while true ; do echo "hey"; sleep 1; done > /dev/null

See answer on the docker lists.

Upvotes: 2

Related Questions