Quantcast
Channel: Why docker container exits immediately - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by kta for Why docker container exits immediately

$
0
0

Docker container terminates immediately when it did not have any foreground process that helps to connect to user terminal. For example, there is no web server up running in that container.

There are couple of ways to create a foreground process. One such method is to redirect to /dev/null which prevents container from immediate exit. After that you can use exec command with -it parameter to attach it to your terminal.

docker run -d ubuntu tail -f /dev/nulldocker exec -it 0ab99d8ab11c /bin/bash

Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>