Blog > php
If you work in the software industry, you've probably heard of the concepts of container and Docker. Docker and containers are a breakthrough in software development and delivery, a new way of running software.
Docker is a new technology that allows development teams to build, manage and secure applications anywhere.
Today we will look at how we can run our PHP project with Docker.Our requirements;
- A text editor to create PHP & Dockerfile files
- Docker installed server
Let say we have a simple Hello World project and we aim to dockerize that. The simple index file that we use for this example is;
First of all, we create a file named DockerFile in the root directory (same directory with index.php) of our PHP project and save it by typing the following lines.
The lines in this file explained as follow;
- The first line specifies our Container image. Here we got the official php7.4 Apache image from Docker Hub.
- In the second line, we copied our index file to Apache's server root directory.
- Later, we configured the server to broadcast over port 80.
- Finally we set Apache to run in the background.
Now Docker enters the scene
At this stage, we throw our project on our server and run the following command first.
We compiled our image named phpDockerDemo with v1 tag in the directory we are in. The tag is optional.
Then write the following command to run
With this command, our phpDockerDemo v1 tag image (-d) will be broadcasting in the background (-p) to 80 external port and 80 internal port.
By opening your browser, you can now access our demo project with your server url.Conclusion
This is the simplest workflow for containerization of a PHP project. You can build up more complex projects with containerization
- .Net Core (4)
- 3D Printing (1)
- Agile Methodologies (1)
- AI in Healthcare (1)
- amazon web services (1)
- Angular (3)
- Angular vs VueJS (1)
- Artificial Intelligence (4)
- ASP.NET Core (1)
- Blockchain (1)
- Business Analysis (3)
- Chatbot (1)
- Design Patterns (1)
- Development Roadmap (1)
- Digital Health (6)
- Embedded Systems (1)
- End to end testing with protractor (1)
- Flutter (1)
- Frontend Development (1)
- Healthcare (3)
- Human Resources in Amatis (1)
- Message Broker (1)
- Nanotechnology (1)
- Neuralink (1)
- Open Source Software (1)
- ORM - Object Relational Mapping (1)
- php (2)
- Predictive Analytics (1)
- Profiling (1)
- Programming (2)
- Project Management (1)
- Real-world data (1)
- Robot (1)
- SaaS (1)
- Smart Wearables (2)
- Software Defined Environment (1)
- Telehealth (1)
- Test Automation (2)
- Test Driven Development (2)
- UI/UX Design (2)
- Version Control | Git (1)
- Virtual Reality and Augmented Reality (1)
- Vue (2)
- Vuex (1)
- Work Experience (1)
- Young Talent (1)