When creating a generic container is there a better way than running an endless ping or tail to keep the container from exiting?
FROM ubuntu
RUN apt-get update && \
apt-get install -y \
python-pip
VOLUME /flask
EXPOSE 8080:8080
CMD ["tail", "-f", "/dev/null"]
All other attempts at keeping a process running exit with code 0, after running docker-compose up
Best Answer
This is expected behavior for "docker-compose up". From the docs (here)
The
docker-compose up
command aggregates the output of each container. When the command exits, all containers are stopped. Runningdocker-compose up -d
starts the containers in the background and leaves them running.