Usually Containers stop once their main process exits but in your case, the main process is a shell (/bin/sh or bash). A shell without a TTY attached exits immediately.
If you want to keep your container running, add a TTY to the container;
When using docker run;
Run a container interactively;
docker run -it centos:7 bash
Run the container in the background ("detached", -d);
docker run -dit centos:7 bash
When using a
docker-compose.yml:
version: "2"
services:
data:
build:
context: ./docker-build
dockerfile:
Dockerfile.data
restart: always
ports:
- "8082:8082"
command: bash
tty: true