I want to set local domain with SSL with PHP-8.0 & Mysql-8.0

Hello,
I install Apache & mysql with local docker with generate crt & key file.

According to Setup local domain and SSL for PHP-apache container i set docker-compose.yml file & add filed in apache but domain not wokring.

When i enter in local docker & enable site than it’s wokring in docker but not working in browser.
When run docker-compose up -d than shown error on RUN a2ensite local.example.com line as site not available.

Here also one problem i fetch as whenever docker restart new created DB is removed.
docker file as below

apacheweb:
    build: ./php/
    volumes:
      ......
      - './code:/var/www/html'
    container_name: apacheweb
    ports:
    - 8000:80
    - 8443:443
  db:
    build: ./mysql
    container_name: db
    restart: always
    ports:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: "tec@123"

a2ensite is for enabling virtual hosts. There is no virtual host in Docker containers by default and you don’t need them. You can run a container for each site.I don’t know why the domain works in the container, but you need a nameserver to have a working domain or add that domain to your local /etc/hosts on Linux. It is mentioned in the topic that you linked. How did you configure the domain?

Since you don’t have a volume nor a bind mounted folder for that container, it is understandable. But this is an other question. Please, if my answer here is not enough, open a new topic, but first, try to search for the issue on the forum. You used bind mount for apache, so you probably understand what you need for the db.