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

Build the first Dockerfile

王林
Release: 2020-06-13 17:47:44
forward
2655 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 Issues
python - dockerfile permission issue
From 1970-01-01 08:00:00
0
0
0
Install XML-RPC in PHP8 Dockerfile
From 1970-01-01 08:00:00
0
0
0
dockerfile - Docker doesn't show port mapping?
From 1970-01-01 08:00:00
0
0
0
dockerfile - docker build image process error
From 1970-01-01 08:00:00
0
0
0
Run composer install in Dockerfile
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template