Answer the question
In order to leave comments, you need to log in
Why can some images run in the background while others can't?
Simple example, create docker-compose.yml with content:
version: '3.1'
services:
ubuntu:
image: ubuntu
postgres:
image: postgres:9.6
php-fpm:
image: otezvikentiy/php7.2-fpm:0.0.11
web:
image: "debian:stretch-slim"
Starting docker_d_php-fpm_1 ... done
Starting docker_d_ubuntu_1 ... done
Starting docker_d_postgres_1 ... done
Starting docker_d_web_1 ... done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d3d6dfbafbd0 otezvikentiy/php7.2-fpm:0.0.11 "docker-php-entryp..." 4 minutes ago Up 2 minutes 22/tcp, 9000/tcp docker_d_php-fpm_1
3271a44ede0f postgres:9.6 "docker-entrypoint..." 6 minutes ago Up 2 minutes 5432/tcp docker_d_postgres_1
Answer the question
In order to leave comments, you need to log in
Because in order for the docker container to remain running in the background, you need a running process in the container to serve it.
ubuntu and debian exit after startup because there are no running processes
and Postgres and php-fpm start the appropriate processes in their container
As a hack - adding for example a line to the container in docker-compose:
you keep the container running in the background, because the container will serve the process tail -f /dev/null
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question