Dockerfile files those things (one)

Source: Internet
Author: User

Dockerfile files those things ( one )

The Dockerfile is used to build the image , and there are several instructions in the file :

From

Maintainer

RUN

EXPOSE

After these four commands, let's talk about their role.

There are also a few common directives :

Cmd

Enterypoint

ADD

COPY

VOLUME

Workdir

Env

USER

These commands, even if I say it, can't remember , Let's learn and remember .

Let's start with the Dockerfile Build Process

1. Run a container from the underlying image

2. Execute an instruction to make changes to the container

3. Perform a docker commit -like Operation and submit a new mirroring layer

4. Run a new container based on the mirror you just submitted

5. Execute the Next hop command in the Dockerfile until all instructions have been executed .

Sometimes the landlord is quite drunk , why , every time want a bit of time , such as saving the world Ah , Help the country's leaders to find nuclear warheads ah , to help the neighbor's children find the ball Ah , there will be various resistance in the Block landlord forward .

[Email protected]:/# mkdir-p dockerfile/df_test2/[email protected]:~# cd dockerfile/df_test2/[email protected]:~/ dockerfile/df_test2# Vim Dockerfile


The contents of the file are as follows :

From Ubuntumaintainer syx ' [email protected] ' RUN apt-get update && apt-get install-y nginxexpose 80


Let's just leave the instructions , and guess what you mean.

Landlord for the sake of simplicity , with the simplest instructions to form a Dockerfile. Note that the name of this file must be called Dockerfile.

[Email protected]:~/dockerfile/df_test2# docker build-t= "Syx/df_test2".


After,after a long wait,you think about it.,landlord for a total of a few lines of command on the implementation of a fast one hours,and it's still going wrong in the middle.,drunk.,it's a dog..I can imagine what would happen if the instructions were too much.,landlord is trying to solve in the constructionDockerfileIt 's a slow problem .,If you have a good idea, please don't hesitate to enlighten me..Thanks!!

[Email protected]:~/dockerfile/df_test2# docker build-t= "Syx/df_test2". [Email protected]:~/dockerfile/df_test2# Docker Images


We can see the image we built ourselves .

Isn't it amazing?,Here you need to make sure that your machine is able to surf the internet,landlord do not understand why in the constructionDockerfilewhen it's so slow,landlord in useDockerfilethe image is built fromHttp://archive.ubuntu.com/ubuntuon this site Pullof the content,this site is foreign.,need to turn over the wall or by some means to quickly Pullsomething.landlord will not turn over the wall for the moment,There's no good way.,If you have,Please advise twos!!!Grateful!!!I'll give you a knee lick .!

Dockerfile files those things (one)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.