Build the first Dockerfile

王林
Release: 2020-06-13 17:47:44
forward
2481 people have browsed it

Build the first Dockerfile

First, we need to create an empty Dokcerfile file;

mkdir dockerfile_test cd dockerfile_test/ touch Dockerfile nano Dockerfile
Copy after login

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
Copy after login

Finally, we build through the docker build command;

docker build -t="lianggzone/nginx_demo:v1" .
Copy after login

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!

Related labels:
source:juejin.im
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!