Home >Operation and Maintenance >Docker >Build the first Dockerfile

Build the first Dockerfile

王林
王林forward
2020-06-13 17:47:442619browse

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.

Build the first Dockerfile

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!

Statement:
This article is reproduced at:juejin.im. If there is any infringement, please contact admin@php.cn delete