Run command in background does not work

My aim is to start docker in background. Due to some issues with services, I want to start docker manually in background.

Here my approach, where I run the docker daemon in background, so I don’t have the output on the command line and the command line is not blocked by the process.

  • nginx in docker how to disable http redirects to https
  • Want to autobuild a docker image when a third repository is updated
  • Setting up dnsmasq docker container for dns-caching
  • Docker as a Proxy server for a web service
  • Docker DNS for Service Discovery to resolve Windows Container´s address by name does not work consistently
  • Docker. npm install -> Error: getaddrinfo ENOTFOUND
  • HTTP_PROXY=http://example.net:8080 HTTPS_PROXY=http://example.net:8080 docker -d > docker.log &
    

    But my approach does not work. The output is displayed on the command line and the command line is blocked by the process. Any ideas? Thank you.

  • How to get all Travis CI environment variables, excluding the default system ones?
  • Docker create a test machine
  • Cross compile net/http for distribution
  • Rancher imageUuid not Unique
  • Elastic Beanstalk Multi-Container Environment cannot mount fuse mount as docker volume
  • Using xdebug through Docker container in PhpStorm
  • One Solution collect form web for “Run command in background does not work”

    You need to redirect standard error as well. On my machine, this worked for me and was silently running in the background…

    sudo docker -d 2> docker.err.log > docker.log &

    Edit: And yes, as that_other_guy correctly pointed out, if you don’t redirect stderr and put it in the background with &, (as you have) the console output just makes it look like its still running in the foreground.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.