How to make a docker image file?

coldplay.xixi
Release: 2020-07-27 10:47:30
Original
2768 people have browsed it

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
Copy after login
# 将所有者(作者)信息写入到镜像中
MAINTAINER test-name  test-mail@163.com
Copy after login
# 将本地的文件, 复制到镜像中
COPY project-directory /usr/share/nginx/html
Copy after login

2 , Build docker image

docker build -t my-test-image
Copy after login

3. Run the container and use browser access test

docker run  -d -p 8080:80  my-test-image
Copy after login

4. Browser access test

http://127.0.0.1
Copy after login

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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template