Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run dockerd in the background without logs

I am using franela/dind image to get a bash:

docker run --rm --privileged -it franela/dind bash

*make sure to remove /etc/docker/daemon.json before running dockerd.

Inside it I ran dockerd and it start to print lots of logs:

WARN[2019-02-24T13:40:16.902536038Z] could not change group /var/run/docker.sock to docker: group docker not found 
INFO[2019-02-24T13:40:16.922239343Z] libcontainerd: started new docker-containerd process  pid=880
INFO[2019-02-24T13:40:16.922290278Z] parsed scheme: "unix"                         module=grpc
INFO[2019-02-24T13:40:16.922302876Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-02-24T13:40:16.922360290Z] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2019-02-24T13:40:16.922373417Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-02-24T13:40:16.922423556Z] pickfirstBalancer: HandleSubConnStateChange: 0xc4203c96e0, CONNECTING  module=grpc
INFO[0000] starting containerd                           revision=468a545b9edcd5932818eb9de8e72413e616e86e version=v1.1.2
INFO[0000] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1

I tried to run it without the logs but everything I tried didn't help:

# run as a background process
dockerd &  
# redirect the output to /dev/null
dockerd > /dev/null
# try to remove the logs with the --log-level switch
dockerd --log-level error  

How can I run the dockerd service without all these logs? make it in quite mode.

like image 818
E235 Avatar asked Feb 24 '19 13:02

E235


1 Answers

The logs from dockerd are printed out to stderr. You can redirect this to a file and run it in the background like this:

sudo docker run --privileged --rm -ti --entrypoint sh docker:18-dind
dockerd &> dockerd-logfile &

# check out the log stream, to cancel use ctrl+c
tail dockerd-logfile

# just to see it's still running
ps -ef

Of course you can also discard all logs similar to what you have already tried: dockerd &> /dev/null &

like image 80
webwurst Avatar answered Nov 13 '22 06:11

webwurst