Home  >  Article  >  Operation and Maintenance  >  How to make a docker image file?

How to make a docker image file?

coldplay.xixi
coldplay.xixiOriginal
2020-07-27 10:47:302767browse

How to make a docker image file: first create a Dockerfile; then build the docker image, the code is [docker build -t my-test-image]; finally run the container and access the test with a browser.

How to make a docker image file?

How to make a docker image file:

1. Create a Dockerfile

# 表示依赖其它的镜像, 必须保证本地有这个镜像
from nginx
# 将所有者(作者)信息写入到镜像中
MAINTAINER test-name  test-mail@163.com
# 将本地的文件, 复制到镜像中
COPY project-directory /usr/share/nginx/html

2 , Build docker image

docker build -t my-test-image

3. Run the container and use browser access test

docker run  -d -p 8080:80  my-test-image

4. Browser access test

http://127.0.0.1

Recommended related tutorials: docker tutorial

The above is the detailed content of How to make a docker image file?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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