• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to setup Lamp Stack by Docker Compose on Debian 11.3

  • 00:30 lsb_release -a
  • 00:47 docker -v
  • 01:01 apt-get install docker docker-compose
  • 01:31 mkdir docker
  • 01:41 cd docker/
  • 01:54 nano docker-compose.yml
  • 04:01 docker-compose up
7133

To Setup Lamp Stack By Docker Compose on Debian 11.3

Introduction:

The Docker Compose software was created to help define and share multi-container applications. Furthermore, we can use YAML files to define services, and with just a single command, we can start or stop everything.

Installation Procedure:

Step 1: Check the OS version by using the below Command

root@linuxhelp: ~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

Step 2: Check the Docker Version by using the below command

root@linuxhelp: ~# docker -v 
Docker version 20.10.17, build 100c701

Step 3: Install the Docker Compose Packages by using the below command

root@linuxhelp: ~# apt-get install docker docker-compose

Step 4: Create a directory as docker by using the below command

root@linuxhelp: ~# mkdir docker 

Step 5: Change to the docker directory by using the below command

root@linuxhelp: ~# cd docker/

Step 6: Create a Docker Compose file by using the below command

root@linuxhelp: ~/docker# nano docker-compose.yml 

version: "3"
services:
  web:
    image: "httpd"
    restart: 'always'
    depends_on:
      - mariadb
    restart: 'always'
    ports:
      - '8080:80'
    links:
      - mariadb
  mariadb:
    image: "mariadb"
    restart: 'always'
    environment:
      MYSQL_ROOT_PASSWORD: linuxc
MYSQL_DATABASE: lamp
      MYSQL_USER: luser
      MYSQL_PASSWORD: linuxc

  php:
    image: "php"
    restart: 'always'

Step 7: Execute the Docker Compose file by using the below command

root@linuxhelp: ~/docker# docker-compose up 
Creating network "docker_default" with the default driver
Pulling mariadb (mariadb:)...
latest: Pulling from library/mariadb
08c01a0ec47e: Pull complete
a2bcb14c13a1: Pull complete
29c56760f879: Pull complete
a95000a218fc: Pull complete
a765d76e68d9: Pull complete
c6945738f085: Pull complete
62787b7c58c5: Pull complete
d2987a30cfe4: Pull complete
cbc65983d8b5: Pull complete
db216f91595e: Pull complete
Digest: sha256:ca31f38b6e325ece985d857db7eba1fe59928b4fd83ff8a55cb912c9684b9e43
Status: Downloaded newer image for mariadb: latest
Pulling web (httpd:)...
latest: Pulling from library/httpd
5eb5b503b376: Pull complete
a43a76ccc967: Pull complete
942bd346e7f7: Pull complete
cdb155854ae6: Pull complete
10c4d45228bf: Pull complete
Digest: sha256:5cc947a200524a822883dc6ce6456d852d7c5629ab177dfbf7e38c1b4a647705
Status: Downloaded newer image for httpd: latest
Pulling php (php:)...
latest: Pulling from library/php
5eb5b503b376: Already exists
8b1ad84cf101: Pull complete
38c937dadeb7: Pull complete
6a2f1dc96e59: Pull complete
09f78174268e: Pull complete
789f1e9593c6: Pull complete
cefa19191812: Pull complete
6773fb0526e7: Pull complete
e0dc0a9c3fe9: Pull complete
Digest: sha256:f1d66b530e99d2e3c2ea302523c5a10ae9e666ddb5ceaacb7dda0af20c7976d7
Status: Downloaded newer image for php:latest
Creating docker_php_1     ... done
Creating docker_mariadb_1 ... done
Creating docker_web_1     ... done
Attaching to docker_mariadb_1, docker_php_1, docker_web_1
php_1      | Interactive shell
php_1      | 
php_1      | php > mariadb_1  | 2022-08-08 20:49:21+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
mariadb_1  | 2022-08-08 20:49:22+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mariadb_1  | 2022-08-08 20:49:22+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
mariadb_1  | 2022-08-08 20:49:22+00:00 [Note] [Entrypoint]: Initializing database files
mariadb_1  | 2022-08-08 20:49:23 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
web_1      | AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
web_1      | AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
web_1      | [Wed Aug 08 20:49:23.865790 2022] [mpm_event:notice] [pid 1:tid 140529800916288] AH00489: Apache/2.4.52 (Unix) configured -- resuming normal operations
web_1      | [Wed Aug 08 20:49:23.874958 2022] [core:notice] [pid 1:tid 140529800916288] AH00094: Command line: 'httpd -D FOREGROUND'
docker_php_1 exited with code 0
mariadb_1  | 
mariadb_1  | 
mariadb_1  | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
mariadb_1  | To do so, start the server, then issue the following command:
mariadb_1  | 
mariadb_1  | '/usr/bin/mysql_secure_installation'
mariadb_1  | 
mariadb_1  | which will also give you the option of removing the test
mariadb_1  | databases and anonymous user created by default.  This is
mariadb_1  | strongly recommended for production servers.

Step 8: Go to the browser Ping http://localhost:8080 as shown in the below image. snap 1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to setup Lamp Stack by Docker Compose on Debian 11.3. Your feedback is much welcome.

Tags:
muhammad
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is Docker-compose vs Docker file?

A

Docker file is a simple text file that contains the commands a user could call to assemble an image whereas Docker Compose is a tool for defining and running multi-container Docker applications

Q

What does Docker compose start do?

A

The Docker compose start command is useful only to restart containers that were previously created, but were stopped.

Q

How to run a container in the background?

A

To run a Docker container in the background or the detached mode from the terminal, you can use the Docker run command followed by the -d flag (or detached flag) and followed by the name of the Docker image you need to use in the terminal.

Q

Which command flag used to run Docker compose in background?

A

If you want to force Compose to stop and recreate all containers, use the --force-recreate flag.

Q

Why we should use Docker?

A

As Docker reduces the need for more infrastructure resources for development and the container created for individual processes can be shared with other apps with instances of these containerized apps using less memory compared to virtual machines – it makes the development and deployment process more cost-effective.

Related Tutorials in How to setup Lamp Stack by Docker Compose on Debian 11.3

Related Tutorials in How to setup Lamp Stack by Docker Compose on Debian 11.3

How to install Gparted on Debian 9.0
How to install Gparted on Debian 9.0
Sep 13, 2017
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Sep 19, 2018
How to Install LAMP on Popos
How to Install LAMP on Popos
May 30, 2018
How to install and update OpenSSL on Debian 11.3
How to install and update OpenSSL on Debian 11.3
Oct 21, 2022
How to install qBittorrent on Debian 9.0
How to install qBittorrent on Debian 9.0
Sep 8, 2017
How to Install FileZilla in Debian
How to Install FileZilla in Debian
Nov 29, 2016
How to install Nmap on Debian 9.0
How to install Nmap on Debian 9.0
Sep 9, 2017
How to Install Laravel in Debian
How to Install Laravel in Debian
Dec 7, 2016

Related Forums in How to setup Lamp Stack by Docker Compose on Debian 11.3

Related Forums in How to setup Lamp Stack by Docker Compose on Debian 11.3

MariaDB
ryan class=
E: Unable to locate package mariadb-server
Sep 18, 2017
Linux
AadrikaAnshu class=
How to add timestamps to history On Any Linux Machine
Jun 18, 2019
vim
jacob class=
Change true vi-compatible editor from Debian Vim-compatible
Nov 8, 2021
debian
anandaamatya class=
RedNotebook on Debian buster
Jun 30, 2020
LAMP
victorsamuel class=
Install LAMP stack with single command
Jan 9, 2018
Ubuntu
Kirin class=
Videos Always Micro-Shutter
Mar 8, 2019
debian
luke class=
workbench for debian
May 26, 2017
debian
teddybarax class=
Softwae installation problem
Aug 24, 2020

Related News in How to setup Lamp Stack by Docker Compose on Debian 11.3

Related News in How to setup Lamp Stack by Docker Compose on Debian 11.3

Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Feb 28, 2017
Mass update of Jessie - A better alternative to new version?
Mass update of Jessie - A better alternative to new version?
May 8, 2017
Debian 9.2 ‘Stretch’ OS is here, download distro now
Debian 9.2 ‘Stretch’ OS is here, download distro now
Oct 9, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.