With only two lines here, it's straightforward. DockerfileĬreate a file named Dockerfile in the root directory of your folder. The actual instructions for building the image are in the Dockerfile file. This file tells Docker to create a service called php that runs the image php with container name php and exposes the port that we will later set to 8080. It comes with Docker, so you should already have access to it.Ĭreate a file named docker-compose.yml in the root directory of your folder. There are several ways to do this, but the easiest way is to use the Docker Compose tool. Now that we have an app to deploy and the basic terms for Docker defined, let's deploy it on a Docker container. The instructions in this file are used to create an image. It is a collection of files and commands that can be used to create a Docker container, and it is stored inside of a file called Dockerfile. It is designed to run a specific application, such as a web server, or a database.Ī Docker image is a blueprint for a Docker container. It is a single process that runs on a single computer. As said before, Docker is a containerization technology that makes it easy to create, deploy, and run applications inside containers.Ī Docker container is a lightweight, portable, and isolated unit of software. Docker Overviewīefore we continue, let's run through a quick overview of how Docker works. This is how it will look once it is running. This file is just a simple PHP file that will print out the PHP version and some information about the server. This tutorial assumes that you already have a PHP app that you want to deploy on a Docker container, however we will build a very minimal one from scratch.Ĭreate a file named index.php in the src directory. Directory Structureīy the end of this tutorial, our application will be in the following directory structure: appĪs you can see, it's a simple application with a few files for the purposes of this tutorial. Restart your computer to ensure the changes can take effect.After it downloads, run the installer until the end.Visit the official Docker website to get the installer. ![]()
0 Comments
Leave a Reply. |