Docker Compose web server container is closed after UP

Good evening everyone,

I’m currently setting up an Apache2 & PHP web server. I now have the following problem: I wrote a Dockerfile and a docker-compose.yml.

After I got the command
sudo docker-compose up -d
If you enter the services are started, I also get the message “done” but they shut down directly under
sudo docker ps
no active containers can be found *

I also cannot reach the website via http: // IP ADDRESS …

Dockerfile
FROM debian
RUN apt update
RUN apt install apache2

docker-compose.yml
version: "3.8"
services:
  webserver:
    image: httpd: latest
    build:.
    ports:
      - "80:80"
      - "443: 443"
    volumes:
    - / var / www / html :.
  php:
    image: php: latest
    build:.
    volumes:
    - / var / www / html :.

Maybe someone can help me, thank you!

  • It can also be that I simply use it wrongly, I only tried to deal with docker today