this post was submitted on 12 Oct 2023
3 points (100.0% liked)

Docker

452 readers
9 users here now

founded 1 year ago
MODERATORS
 

Hello. I bought a HP t630 and wanted to learn some ubuntuServer+Docker. My file structure looks like this:


/home/bg/docker_stacks (main folder)
/home/bg/docker_stacks/prod_php-maria-apache (this project folder)
/home/bg/docker_stacks/prod_php-maria-apache/docker-compose.yml

/home/bg/docker_stacks/prod_php-maria-apache/apache/

/home/bg/docker_stacks/prod_php-maria-apache/html/
/home/bg/docker_stacks/prod_php-maria-apache/html/test.php

/home/bg/docker_stacks/prod_php-maria-apache/php/
/home/bg/docker_stacks/prod_php-maria-apache/php/php.ini empty

inside test.php there's


inside docker-compose.yml there's:

GNU nano 6.2                                                                                                                                                                                       docker-compose.yml                                                                                                                                                                                                 
 web:
   image: php:8.2-cli
   ports:
     - '80:80'
   volumes:
     - /home/bg/docker_stacks/prod_maria-php-apache/apache:/etc/apache2/sites-enabled
     - /home/bg/docker_stacks/prod_maria-php-apache/html:/var/www/html
     - /home/bg/docker_stacks/prod_maria-php-apache/php/php.ini:/usr/local/etc/php/php.ini
   depends_on:
     - mariadb
   extra_hosts:
     - 'ax710.test:127.0.0.1'
     # - 'some-other-host.test:127.0.0.1'
   networks:
     - dev-env
 phpmyadmin:
   image: phpmyadmin:latest
   ports:
     - 8080:80
   environment:
     - PMA_ARBITRARY=1
     - PMA_HOST=mariadb
   depends_on:
     - mariadb
   volumes:
     - /home/bg/docker_stacks/prod_maria-php-apache/php/php.ini:/usr/local/etc/php/php.ini
   networks:
     - dev-env
 mariadb:
   image: mariadb:latest
   restart: always
   environment:
     MYSQL_ROOT_PASSWORD: '123'
     MYSQL_USER: 'bg'
     MYSQL_PASSWORD: '123'
     MYSQL_DATABASE: 'db'
   volumes:
     - mysqldata:/var/lib/mysql
   ports:
     - 3306:3306
   networks:
     - dev-env

volumes:
 mysqldata: {}

networks:
 dev-env: {}

When on my laptop I open:

192.168.1.208:9090 - cockpit works fine

192.168.1.208:8080 - phpMyAdmin works fine

heidiSQL - at 192.168.1.208 opens the database without problems

192.168.1.208:80/test.php or 192.168.1.208/test.php does not work

Any ideas how can I make test.php open in my browser? Any other suggestions are appreciated as I'am newbie in Docker.

you are viewing a single comment's thread
view the rest of the comments