Hi guys,
I’m relatively new to Docker. I’ve watched tutorials and experimented a bit. Now I wanted to build a development environment in Docker, but whatever I do, whatever tutorial I look at, I can’t get Apache to work.
I use Docker for Windows and run the containers on the same computer that I work on.
Here is my data:
Directory structure:
Docker
|- backups
|- configs (with php.ini and http.conf. Both currently unchanged)
|- databases
|- logs
|- www (with an index.php
<?php
phpinfo();
)
|- meinWebserver.yml
meinWebserver.yml looks like this:
version: '3.8'
name: devserver
services:
mariadb:
image: mariadb:latest
container_name: mariadb
environment:
- MYSQL_ROOT_PASSWORD=***************
- MYSQL_DATABASE=testdb
- MYSQL_USER=xjuliuscaesar
- MYSQL_PASSWORD=***************
volumes:
- ./database:/var/lib/mysql
networks:
- devnetwork
restart: always
webserver:
image: php:apache
container_name: webserver
depends_on:
- mariadb
ports:
- 80:80
- 443:443
volumes:
- ./www:/var/www/html
- ./configs/php.ini:/usr/local/etc/php/php.ini
networks:
- devnetwork
restart: always
phpmyadmin:
image: phpmyadmin:latest
container_name: phpmyadmin
depends_on:
- mariadb
- webserver
volumes:
- ./configs/php.ini:/usr/local/etc/php/php.ini
ports:
- 81:80
environment:
- PMA_ARBITRARY=1
- PMA_HOST=mariadb
networks:
- devnetwork
restart: always
networks:
devnetwork:
driver: bridge
name: devnetwork
The web server itself seems to be running, because I can access its file system via Docker.
phpMyAdmin and MariaDB are also running and in the meantime I can also log in to the database via localhost:81 with the corresponding user and password. The addition PMA_HOST=mariadb was actually missing in almost all tutorials.
What does not work is the call to localhost itself. Even if I change the port, nothing happens. The browser searches stupidly. I don’t get an error message or anything like that. It just searches for minutes and then just stops at some point.
Does anyone have any ideas that could help me?
I also had the same problem with nginx.
With best regards and thanks