Aleksander Zendel
Aleksander Zendel

Reputation: 493

Daemon started with "docker run daemon" is not working

docker run -itp 26542:26542  stack/vowpall vw -t -i /home/alex/cb.model --daemon --port 26542

when I run this command there is no daemon listening. When I run

docker ps 

there are no processes but when I go to docker container bash and run

vw -t -i /home/alex/cb.model --daemon --port 26542 

there is a daemon listening, also visible in docker ps. Any ideas?

Upvotes: 1

Views: 196

Answers (1)

Adrian Mouat
Adrian Mouat

Reputation: 46480

The problem is that the daemon is forking to the background and a Docker container only runs as long as its main process. When the daemon forks to the background, the main process ends and so does the container. You just need to keep the application running in the foreground, which probably just means removing the --daemon argument.

Also, you only need the -it arguments if you want a shell, so you can remove them as well. If you want to get the shell on your host back after running the docker command, add -d so that the client disconnects after starting the container e.g:

docker run -d p 26542:26542  stack/vowpall vw -t -i /home/alex/cb.model --port 26542

Upvotes: 1

Related Questions