Home >Operation and Maintenance >Docker >Build the first Dockerfile
First, we need to create an empty Dokcerfile file;
mkdir dockerfile_test cd dockerfile_test/ touch Dockerfile nano Dockerfile
Next, we need to write a Dockerfile file, the code list is as follows:
FROM centos:7 MAINTAINER LiangGzone "lianggzone@163.com" RUN rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm RUN yum install -y nginx EXPOSE 80
Finally, we build through the docker build command;
docker build -t="lianggzone/nginx_demo:v1" .
Now, let’s take a look at our new image through docker images.
Recommended tutorial: docker
The above is the detailed content of Build the first Dockerfile. For more information, please follow other related articles on the PHP Chinese website!